diff --git a/client/mobile/package.json b/client/mobile/package.json index d166184e..8c60d8e6 100644 --- a/client/mobile/package.json +++ b/client/mobile/package.json @@ -3,10 +3,13 @@ "version": "0.0.1", "private": true, "scripts": { + "GetuiConfigure": "node node_modules/react-native-getui/GetuiConfiguration.js", "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", + "patch-package": "patch-package", + "postinstall": "patch-package", "plugins:all": "ministar buildPlugin all", "test": "jest" }, @@ -16,6 +19,8 @@ "immer": "^9.0.19", "lodash": "^4.17.21", "mini-star": "^2.0.8", + "patch-package": "^6.5.1", + "postinstall-postinstall": "^2.1.0", "react": "18.2.0", "react-native": "0.71.2", "react-native-config": "^1.5.0", diff --git a/client/mobile/patches/react-native-getui+1.1.42.patch b/client/mobile/patches/react-native-getui+1.1.42.patch new file mode 100644 index 00000000..bfe33c64 --- /dev/null +++ b/client/mobile/patches/react-native-getui+1.1.42.patch @@ -0,0 +1,42 @@ +diff --git a/node_modules/react-native-getui/android/build.gradle b/node_modules/react-native-getui/android/build.gradle +index 7cb66cf..86d81cf 100644 +--- a/node_modules/react-native-getui/android/build.gradle ++++ b/node_modules/react-native-getui/android/build.gradle +@@ -68,11 +68,4 @@ dependencies { + + implementation 'com.getui:gtsdk:3.2.13.0' //个推SDK + implementation 'com.getui:gtc:3.1.12.0' //个推核心组件 +- +- implementation 'com.getui.opt:hwp:3.1.1' // 华为 +- implementation 'com.getui.opt:xmp:3.3.0' // 小米 +- implementation 'com.assist-v3:oppo:3.2.0' // oppo +- implementation 'com.assist-v3:vivo:3.1.1' // vivo +- implementation 'com.getui.opt:mzp:3.2.2' // 魅族 +- implementation 'com.getui.opt:ups:3.0.3' // ups,ups目前支持坚果,索尼,海信手机 + } +diff --git a/node_modules/react-native-getui/android/src/main/java/com/getui/reactnativegetui/GetuiModule.java b/node_modules/react-native-getui/android/src/main/java/com/getui/reactnativegetui/GetuiModule.java +index 1b1df8c..9065358 100755 +--- a/node_modules/react-native-getui/android/src/main/java/com/getui/reactnativegetui/GetuiModule.java ++++ b/node_modules/react-native-getui/android/src/main/java/com/getui/reactnativegetui/GetuiModule.java +@@ -2,7 +2,7 @@ package com.getui.reactnativegetui; + + import android.content.Context; + +-import android.support.annotation.Nullable; ++import androidx.annotation.Nullable; + + import com.facebook.react.bridge.Arguments; + import com.facebook.react.bridge.Callback; +diff --git a/node_modules/react-native-getui/android/src/main/java/com/getui/reactnativegetui/PushIntentService.java b/node_modules/react-native-getui/android/src/main/java/com/getui/reactnativegetui/PushIntentService.java +index 4f66448..ec32933 100644 +--- a/node_modules/react-native-getui/android/src/main/java/com/getui/reactnativegetui/PushIntentService.java ++++ b/node_modules/react-native-getui/android/src/main/java/com/getui/reactnativegetui/PushIntentService.java +@@ -5,7 +5,7 @@ package com.getui.reactnativegetui; + */ + + import android.content.Context; +-import android.support.annotation.RequiresPermission; ++import androidx.annotation.RequiresPermission; + + import com.facebook.react.bridge.Arguments; + import com.facebook.react.bridge.WritableMap; diff --git a/client/mobile/src/lib/inject/message-handler.ts b/client/mobile/src/lib/inject/message-handler.ts index ab0dcd3a..d0fcb4ea 100644 --- a/client/mobile/src/lib/inject/message-handler.ts +++ b/client/mobile/src/lib/inject/message-handler.ts @@ -1,9 +1,10 @@ import type WebView from 'react-native-webview'; import { generateInstallPluginScript } from '.'; import { useUIStore } from '../../store/ui'; -import { UserBaseInfo } from '../../types'; +import type { UserBaseInfo } from '../../types'; import { initNotificationEnv, showNotification } from '../notifications'; -import { bindSocketEvent, createSocket } from '../socket'; +// import { bindSocketEvent, createSocket } from '../socket'; +import { AppState } from 'react-native'; export function handleTailchatMessage( type: string, @@ -24,28 +25,30 @@ export function handleTailchatMessage( } if (type === 'showNotification') { - showNotification({ - title: payload.title, - body: payload.body, - icon: payload.icon, - }); + if (AppState.currentState !== 'active') { + showNotification({ + title: payload.title, + body: payload.body, + icon: payload.icon, + }); + } return; } if (type === 'bindWebsocket') { - const serviceUrl: string = payload.url; - const token: string = payload.token; const userInfo = payload.userInfo as UserBaseInfo; initNotificationEnv({ userId: userInfo._id, nickname: userInfo.nickname ?? userInfo.email, runService: () => { - createSocket(serviceUrl, token).then((socket) => { - console.log('[createSocket]', 'socket', socket, 'userInfo', userInfo); - bindSocketEvent(socket); - }); + // const serviceUrl: string = payload.url; + // const token: string = payload.token; + // createSocket(serviceUrl, token).then((socket) => { + // console.log('[createSocket]', 'socket', socket, 'userInfo', userInfo); + // bindSocketEvent(socket); + // }); }, }); } diff --git a/client/mobile/src/lib/notifications/index.ts b/client/mobile/src/lib/notifications/index.ts index 48926977..4a8a342e 100644 --- a/client/mobile/src/lib/notifications/index.ts +++ b/client/mobile/src/lib/notifications/index.ts @@ -53,10 +53,10 @@ export async function initNotificationEnv(options: NotificationOptions) { bindAlias(options.userId); - // await initForegroundService(options); + // 厂商渠道还没有ready, 推送需要依赖前台服务保活 + await initForegroundService(options); } -// eslint-disable-next-line @typescript-eslint/no-unused-vars async function initForegroundService(options: NotificationOptions) { notifee.registerForegroundService((_notification) => { return new Promise(() => { diff --git a/client/mobile/yarn.lock b/client/mobile/yarn.lock index ac036661..0336f2bb 100644 --- a/client/mobile/yarn.lock +++ b/client/mobile/yarn.lock @@ -2039,6 +2039,11 @@ "@typescript-eslint/types" "5.51.0" eslint-visitor-keys "^3.3.0" +"@yarnpkg/lockfile@^1.1.0": + version "1.1.0" + resolved "https://registry.npmmirror.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + abort-controller@^3.0.0: version "3.0.0" resolved "https://registry.npmmirror.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" @@ -2949,7 +2954,7 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" -cross-spawn@^6.0.0: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -3951,6 +3956,13 @@ find-up@^5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" +find-yarn-workspace-root@^2.0.0: + version "2.0.0" + resolved "https://registry.npmmirror.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd" + integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ== + dependencies: + micromatch "^4.0.2" + flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.npmmirror.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -4030,7 +4042,7 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^9.1.0: +fs-extra@^9.0.0, fs-extra@^9.1.0: version "9.1.0" resolved "https://registry.npmmirror.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== @@ -4535,6 +4547,13 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: resolved "https://registry.npmmirror.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.npmmirror.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + is-color-stop@^1.0.0: version "1.1.0" resolved "https://registry.npmmirror.com/is-color-stop/-/is-color-stop-1.1.0.tgz#cfff471aee4dd5c9e158598fbe12967b5cdad345" @@ -4598,6 +4617,11 @@ is-directory@^0.3.1: resolved "https://registry.npmmirror.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" integrity sha512-yVChGzahRFvbkscn2MlwGismPO12i9+znNruC5gVEntG3qu0xQMzsGg/JFbrsqDOHtHFPci+V5aP5T9I+yeKqw== +is-docker@^2.0.0: + version "2.2.1" + resolved "https://registry.npmmirror.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" + integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== + is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.npmmirror.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -4777,6 +4801,13 @@ is-wsl@^1.1.0: resolved "https://registry.npmmirror.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha512-gfygJYZ2gLTDlmbWMI0CE2MwnFzSN/2SZfkMlItC4K/JBlsWVDB0bO6XhqcY13YXE7iMcAJnzTCJjPiTeJJ0Mw== +is-wsl@^2.1.1: + version "2.2.0" + resolved "https://registry.npmmirror.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" + integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== + dependencies: + is-docker "^2.0.0" + isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -5413,6 +5444,13 @@ kind-of@^6.0.0, kind-of@^6.0.2: resolved "https://registry.npmmirror.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +klaw-sync@^6.0.0: + version "6.0.0" + resolved "https://registry.npmmirror.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" + integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== + dependencies: + graceful-fs "^4.1.11" + kleur@^3.0.3: version "3.0.3" resolved "https://registry.npmmirror.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -5905,7 +5943,7 @@ micromatch@^3.1.10: snapdragon "^0.8.1" to-regex "^3.0.2" -micromatch@^4.0.4: +micromatch@^4.0.2, micromatch@^4.0.4: version "4.0.5" resolved "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -6286,6 +6324,14 @@ open@^6.2.0: dependencies: is-wsl "^1.1.0" +open@^7.4.2: + version "7.4.2" + resolved "https://registry.npmmirror.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" + integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== + dependencies: + is-docker "^2.0.0" + is-wsl "^2.1.1" + optionator@^0.9.1: version "0.9.1" resolved "https://registry.npmmirror.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" @@ -6423,6 +6469,26 @@ pascalcase@^0.1.1: resolved "https://registry.npmmirror.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" integrity sha512-XHXfu/yOQRy9vYOtUDVMN60OEJjW013GoObG1o+xwQTpB9eYJX/BjXMsdW13ZDPruFhYYn0AG22w0xgQMwl3Nw== +patch-package@^6.5.1: + version "6.5.1" + resolved "https://registry.npmmirror.com/patch-package/-/patch-package-6.5.1.tgz#3e5d00c16997e6160291fee06a521c42ac99b621" + integrity sha512-I/4Zsalfhc6bphmJTlrLoOcAF87jcxko4q0qsv4bGcurbr8IskEOtdnt9iCmsQVGL1B+iUhSQqweyTLJfCF9rA== + dependencies: + "@yarnpkg/lockfile" "^1.1.0" + chalk "^4.1.2" + cross-spawn "^6.0.5" + find-yarn-workspace-root "^2.0.0" + fs-extra "^9.0.0" + is-ci "^2.0.0" + klaw-sync "^6.0.0" + minimist "^1.2.6" + open "^7.4.2" + rimraf "^2.6.3" + semver "^5.6.0" + slash "^2.0.0" + tmp "^0.0.33" + yaml "^1.10.2" + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.npmmirror.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -6820,6 +6886,11 @@ postcss@^8.2.4: picocolors "^1.0.0" source-map-js "^1.0.2" +postinstall-postinstall@^2.1.0: + version "2.1.0" + resolved "https://registry.npmmirror.com/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3" + integrity sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.npmmirror.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -7334,6 +7405,13 @@ rgba-regex@^1.0.0: resolved "https://registry.npmmirror.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" integrity sha512-zgn5OjNQXLUTdq8m17KdaicF6w89TZs8ZU8y0AYENIU6wG8GG6LLm0yLSiPY8DmaYmHdgRW8rnApjoT0fQRfMg== +rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.npmmirror.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + rimraf@^3.0.2: version "3.0.2" resolved "https://registry.npmmirror.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -7595,6 +7673,11 @@ sisteransi@^1.0.5: resolved "https://registry.npmmirror.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.npmmirror.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + slash@^3.0.0: version "3.0.0" resolved "https://registry.npmmirror.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -8527,7 +8610,7 @@ yallist@^4.0.0: resolved "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@^1.10.0: +yaml@^1.10.0, yaml@^1.10.2: version "1.10.2" resolved "https://registry.npmmirror.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==