diff --git a/client/mobile/android/app/build.gradle b/client/mobile/android/app/build.gradle index 83a12c82..8b1d6e23 100644 --- a/client/mobile/android/app/build.gradle +++ b/client/mobile/android/app/build.gradle @@ -192,6 +192,8 @@ dependencies { } // Push + implementation 'com.getui:gtsdk:3.2.15.0' //个推SDK + implementation 'com.getui:gtc:3.2.1.0' //个推核心组件 implementation 'com.huawei.hms:push:6.9.0.300' } diff --git a/client/mobile/android/app/src/debug/java/com/tailchat/ReactNativeFlipper.java b/client/mobile/android/app/src/debug/java/com/msgbyte/tailchat/ReactNativeFlipper.java similarity index 100% rename from client/mobile/android/app/src/debug/java/com/tailchat/ReactNativeFlipper.java rename to client/mobile/android/app/src/debug/java/com/msgbyte/tailchat/ReactNativeFlipper.java diff --git a/client/mobile/android/app/src/main/AndroidManifest.xml b/client/mobile/android/app/src/main/AndroidManifest.xml index f0c07478..2169e023 100644 --- a/client/mobile/android/app/src/main/AndroidManifest.xml +++ b/client/mobile/android/app/src/main/AndroidManifest.xml @@ -22,9 +22,27 @@ + + + + + + + + + + + + + diff --git a/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/GetuiLogger.java b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/GetuiLogger.java new file mode 100644 index 00000000..384eed83 --- /dev/null +++ b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/GetuiLogger.java @@ -0,0 +1,16 @@ +package com.msgbyte.tailchat; + +import android.util.Log; + +public class GetuiLogger { + + public static boolean ENABLE = true; + + public static final String TAG = "GetuiLogger"; + + public static void log(String message){ + if (ENABLE){ + Log.d(TAG, message); + } + } +} diff --git a/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/GetuiModule.java b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/GetuiModule.java new file mode 100644 index 00000000..c53c3f77 --- /dev/null +++ b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/GetuiModule.java @@ -0,0 +1,349 @@ +package com.msgbyte.tailchat; + +import android.content.Context; + +import androidx.annotation.Nullable; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.Callback; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.modules.core.DeviceEventManagerModule; +import com.igexin.sdk.PushManager; +import com.igexin.sdk.Tag; + +public class GetuiModule extends ReactContextBaseJavaModule { + private static final String TAG = "GetuiModule"; + + public static final String EVENT_RECEIVE_REMOTE_NOTIFICATION = "receiveRemoteNotification"; + + public static final String EVENT_TYPE_RECEIVE_CID = "cid"; + public static final String EVENT_TYPE_PAYLOAD = "payload"; + public static final String EVENT_TYPE_CMD = "cmd"; + public static final String EVENT_TYPE_NOTIFICATION_ARRIVED = "notificationArrived"; + public static final String EVENT_TYPE_NOTIFICATION_CLICKED = "notificationClicked"; + + private static ReactApplicationContext mRAC; + + private static GetuiModule mModule; + + private static Context mContext; + + public GetuiModule(ReactApplicationContext reactContext) { + super(reactContext); + mRAC = reactContext; + } + + @Override + public boolean canOverrideExistingModule() { + return true; + } + + @Override + public String getName() { + return "GetuiModule"; + } + + @Override + public void initialize() { + super.initialize(); + mModule = this; + } + + @Override + public void onCatalystInstanceDestroy() { + super.onCatalystInstanceDestroy(); + mModule = null; + } + + /** + * 初始化推送服务 + */ + public static void initPush(Context context) { + mContext = context; + GetuiLogger.log("initPush, mContext = " + mContext); + PushManager.getInstance().initialize(mContext, TailchatPushService.class); + PushManager.getInstance().registerPushIntentService(mContext, PushIntentService.class); + } + + /** + * Android 不存在 destroy方法,仅停止推送服务 + */ + @ReactMethod + public void destroy() { + // PushManager.getInstance().stopService(mContext); + } + + /** + * 停止SDK服务 + */ + @ReactMethod + public void stop() { + // PushManager.getInstance().stopService(mContext); + } + + /** + * 恢复SDK运行,重新接收推送 + */ + @ReactMethod + public void resume() { + PushManager.getInstance().turnOnPush(mContext); + } + + /** + * 打开SDK的推送. + */ + @ReactMethod + public void turnOnPush() { + PushManager.getInstance().turnOnPush(mContext); + } + + /** + * 关闭SDK的推送. + */ + @ReactMethod + public void turnOffPush() { + PushManager.getInstance().turnOffPush(mContext); + } + + /** + * 获取SDK的Cid + * + * @return Cid值 + */ + @ReactMethod + public void clientId(Callback callback) { + String clientId = PushManager.getInstance().getClientid(mContext); + GetuiLogger.log("clientId = " + clientId); + callback.invoke(clientId); + } + + /** + * 获取SDK运行状态, + * + * @return 运行状态 1为已开启推送,2为已停止推送 + */ + @ReactMethod + public void status(Callback callback) { + boolean isPushTurnOn = PushManager.getInstance().isPushTurnedOn(mContext); + GetuiLogger.log("isPushTurnOn = " + isPushTurnOn); + callback.invoke(isPushTurnOn ? "1" : "2"); + } + + /** + * 获取SDK版本号 + * + * @return 版本号 + */ + @ReactMethod + public void version(Callback callback) { + String version = PushManager.getInstance().getVersion(mContext); + GetuiLogger.log("version = " + version); + callback.invoke(version); + } + + + /** + * 是否允许SDK 后台运行(默认为true) + * 该方法在Android中无效,仅在iOS有效 + * + * @param isEnable + */ + @ReactMethod + public void runBackgroundEnable(boolean isEnable) { + // Empty + } + + + /** + * 地理围栏功能,设置地理围栏是否运行 + * 该方法在Android中无效,仅在iOS有效,在AndroidManifest.xml开启相应地权限 + * + * + * + * @param isEnable 设置地理围栏功能是否运行(默认值:NO) + * @param isVerify 设置是否SDK主动弹出用户定位请求(默认值:NO) + */ + @ReactMethod + public void lbsLocationEnable(boolean isEnable, boolean isVerify) { + // Empty + } + + + /** + * 设置渠道 + * 该方法在Android中无效,仅在iOS有效Ø + * + * @param channelId 渠道值,可以为空值 + */ + @ReactMethod + public void setChannelId(String channelId) { + // Empty + } + + + /** + * 向个推服务器注册DeviceToken + * 该方法在Android中无效,仅在iOS有效 + * + * @param deviceToken + */ + @ReactMethod + public void registerDeviceToken(String deviceToken) { + // Empty + + } + + /** + * 绑定别名功能:后台可以根据别名进行推送 + * + * @param alias 别名字符串 + * @param aSn 绑定序列码, Android中无效,仅在iOS有效 + */ + @ReactMethod + public void bindAlias(String alias, String aSn) { + PushManager.getInstance().bindAlias(mContext, alias); + } + + /** + * 取消绑定别名功能 + * + * @param alias 别名字符串 + * @param aSn 绑定序列码, Android中无效,仅在iOS有效 + */ + @ReactMethod + public void unbindAlias(String alias, String aSn) { + PushManager.getInstance().unBindAlias(mContext, alias, false); + } + + /** + * 给用户打标签 , 后台可以根据标签进行推送 + * + * @param tags 别名数组 + */ + @ReactMethod + public void setTag(ReadableArray tags) { + if (tags == null || tags.size() == 0) { + return; + } + + Tag[] tagArray = new Tag[tags.size()]; + for (int i = 0; i < tags.size(); i++) { + Tag tag = new Tag(); + tag.setName(tags.getString(i)); + tagArray[i] = tag; + } + + PushManager.getInstance().setTag(mContext, tagArray, "setTag"); + } + + /** + * 设置关闭推送模式 + * Android中无效,仅在iOS有效 + * + * @param isValue + */ + @ReactMethod + public void setPushModeForOff(boolean isValue) { + // Empty + } + + /** + * 同步角标值到个推服务器 + * Android中无效,仅在iOS有效 + * + * @param value + */ + @ReactMethod + public void setBadge(int value) { + // Empty + } + + /** + * 重置角标值到个推服务器 + * Android中无效,仅在iOS有效 + * + * @param badge + */ + @ReactMethod + public void resetBadge(int badge) { + //Empty + } + + + /** + * SDK发送上行消息结果 + * Android中无效,仅在iOS有效 + * + * @param body 需要发送的消息数据 + * @param error 如果发送成功返回messageid + */ + @ReactMethod + public void sendMessage(String body, String error) { + // Empty + + } + + /** + * 上行第三方自定义回执actionid + * + * @param actionId 用户自定义的actionid,int类型,取值90001-90999。 + * @param taskId 下发任务的任务ID + * @param msgId 下发任务的消息ID + * @return 上行成功或失败,若上行失败,可能上行失败;taskid为空或者 messageid 为空 或者 actionid 不在取值范围以内 + */ + @ReactMethod + public void sendFeedbackMessage(int actionId, String taskId, String msgId, Callback callback) { + callback.invoke(PushManager.getInstance().sendFeedbackMessage(mContext, taskId, msgId, actionId)); + } + + /** + * 设置静默时间 + * + * @param beginHour 开始时间,设置范围在0-23小时之间,单位 h + * @param duration 持续时间,设置范围在0-23小时之间。持续时间为0则不静默,单位 h + */ + @ReactMethod + public void sendSilentTime(int beginHour, int duration, Callback callback) { + callback.invoke(PushManager.getInstance().setSilentTime(mContext, beginHour, duration)); + } + + + /** + * 设置Socket超时时间 + * + * @param times 超时时间 + */ + @ReactMethod + public void setSocketTimeout(int times) { + PushManager.getInstance().setSocketTimeout(mContext, times); + } + + /** + * 往JavaScript发送事件通知 + * + * @param eventName + * @param type + * @param value + */ + public static void sendEvent(String eventName, String type, String key, String value) { + WritableMap param = Arguments.createMap(); + param.putString("type", type); + param.putString(key, value); + sendEvent(eventName, param); + } + + /** + * 往JavaScript发送事件通知 + * + * @param eventName + * @param params + */ + public static void sendEvent(String eventName, @Nullable WritableMap params) { + mRAC.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, params); + } +} + diff --git a/client/mobile/android/app/src/main/java/com/tailchat/MainActivity.java b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/MainActivity.java similarity index 100% rename from client/mobile/android/app/src/main/java/com/tailchat/MainActivity.java rename to client/mobile/android/app/src/main/java/com/msgbyte/tailchat/MainActivity.java diff --git a/client/mobile/android/app/src/main/java/com/tailchat/MainApplication.java b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/MainApplication.java similarity index 97% rename from client/mobile/android/app/src/main/java/com/tailchat/MainApplication.java rename to client/mobile/android/app/src/main/java/com/msgbyte/tailchat/MainApplication.java index 6c115be6..32bdfceb 100644 --- a/client/mobile/android/app/src/main/java/com/tailchat/MainApplication.java +++ b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/MainApplication.java @@ -9,7 +9,6 @@ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; import com.facebook.react.defaults.DefaultReactNativeHost; import com.facebook.soloader.SoLoader; import java.util.List; -import com.getui.reactnativegetui.GetuiModule; public class MainApplication extends Application implements ReactApplication { diff --git a/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/PushIntentService.java b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/PushIntentService.java new file mode 100644 index 00000000..5a0d7697 --- /dev/null +++ b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/PushIntentService.java @@ -0,0 +1,103 @@ +package com.msgbyte.tailchat; + +import android.content.Context; +import androidx.annotation.RequiresPermission; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.WritableMap; +import com.igexin.sdk.GTIntentService; +import com.igexin.sdk.message.GTCmdMessage; +import com.igexin.sdk.message.GTNotificationMessage; +import com.igexin.sdk.message.GTTransmitMessage; + +/** + * 继承 GTIntentService 接收来自个推的消息, 所有消息在线程中回调
+ * onReceiveMessageData 处理透传消息
+ * onReceiveClientId 接收 cid
+ * onReceiveOnlineState cid 离线上线通知
+ * onReceiveCommandResult 各种事件处理回执
+ */ +public class PushIntentService extends GTIntentService { + + public PushIntentService() { + } + + @Override + public void onReceiveServicePid(Context context, int pid) { + GetuiLogger.log("onReceiveServicePid = " + pid); + } + + @Override + public void onReceiveClientId(Context context, String clientId) { + GetuiLogger.log("onReceiveClientId = " + clientId); + WritableMap param = Arguments.createMap(); + param.putString("type", GetuiModule.EVENT_TYPE_RECEIVE_CID); + param.putString("cid", clientId); + GetuiModule.sendEvent(GetuiModule.EVENT_RECEIVE_REMOTE_NOTIFICATION, param); + } + + @Override + public void onReceiveMessageData(Context context, GTTransmitMessage msg) { + String message = new String(msg.getPayload()); + GetuiLogger.log("onReceiveMessageData msg = " + message); + WritableMap param = Arguments.createMap(); + param.putString("type", GetuiModule.EVENT_TYPE_PAYLOAD); + param.putString("payload", message); + GetuiModule.sendEvent(GetuiModule.EVENT_RECEIVE_REMOTE_NOTIFICATION, param ); + } + + @Override + public void onReceiveOnlineState(Context context, boolean online) { + GetuiLogger.log("onReceiveOnlineState online = " + online); + } + + @Override + public void onReceiveCommandResult(Context context, GTCmdMessage cmdMessage) { + GetuiLogger.log("onReceiveCommandResult cmdMessage action = " + cmdMessage.getAction()); + + GetuiModule.sendEvent(GetuiModule.EVENT_RECEIVE_REMOTE_NOTIFICATION, + GetuiModule.EVENT_TYPE_CMD, "action", String.valueOf(cmdMessage.getAction())); + } + + + // 通知到达 + @Override + public void onNotificationMessageArrived(Context context, GTNotificationMessage message) { + GetuiLogger.log("onNotificationMessageArrived -> " + "appid = " + message.getAppid() + "\ntaskid = " + message.getTaskId() + "\nmessageid = " + + message.getMessageId() + "\npkg = " + message.getPkgName() + "\ncid = " + message.getClientId() + "\ntitle = " + + message.getTitle() + "\ncontent = " + message.getContent()); + /* + GetuiModule.sendEvent(GetuiModule.EVENT_RECEIVE_REMOTE_NOTIFICATION,GetuiModule.EVENT_TYPE_CMD,"NotificationArrived",String.valueOf("appid = " + message.getAppid() + "\ntaskid = " + message.getTaskId() + "\nmessageid = " + + message.getMessageId() + "\npkg = " + message.getPkgName() + "\ncid = " + message.getClientId() + "\ntitle = " + + message.getTitle() + "\ncontent = " + message.getContent())); + */ + WritableMap param = Arguments.createMap(); + param.putString("type",GetuiModule.EVENT_TYPE_NOTIFICATION_ARRIVED); + param.putString("taskId",message.getTaskId()); + param.putString("messageId",message.getMessageId()); + param.putString("title",message.getTitle()); + param.putString("content",message.getContent()); + GetuiModule.sendEvent(GetuiModule.EVENT_RECEIVE_REMOTE_NOTIFICATION,param); + } + + // 点击回调 + @Override + public void onNotificationMessageClicked(Context context, GTNotificationMessage message) { + GetuiLogger.log("onNotificationMessageClicked -> " + "appid = " + message.getAppid() + "\ntaskid = " + message.getTaskId() + "\nmessageid = " + + message.getMessageId() + "\npkg = " + message.getPkgName() + "\ncid = " + message.getClientId() + "\ntitle = " + + message.getTitle() + "\ncontent = " + message.getContent()); + /* + GetuiModule.sendEvent(GetuiModule.EVENT_RECEIVE_REMOTE_NOTIFICATION,GetuiModule.EVENT_TYPE_CMD,"NotificatioClicked","appid = " + message.getAppid() + "\ntaskid = " + message.getTaskId() + "\nmessageid = " + + message.getMessageId() + "\npkg = " + message.getPkgName() + "\ncid = " + message.getClientId() + "\ntitle = " + + message.getTitle() + "\ncontent = " + message.getContent()); + */ + WritableMap param = Arguments.createMap(); + param.putString("type",GetuiModule.EVENT_TYPE_NOTIFICATION_CLICKED); + param.putString("taskId",message.getTaskId()); + param.putString("messageId",message.getMessageId()); + param.putString("title",message.getTitle()); + param.putString("content",message.getContent()); + GetuiModule.sendEvent(GetuiModule.EVENT_RECEIVE_REMOTE_NOTIFICATION,param); + } + +} diff --git a/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/TailchatPushService.java b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/TailchatPushService.java new file mode 100644 index 00000000..544e9058 --- /dev/null +++ b/client/mobile/android/app/src/main/java/com/msgbyte/tailchat/TailchatPushService.java @@ -0,0 +1,6 @@ +package com.msgbyte.tailchat; + +import com.igexin.sdk.PushService; + +public class TailchatPushService extends PushService { +} diff --git a/client/mobile/android/settings.gradle b/client/mobile/android/settings.gradle index c8e6b51c..1ad80361 100644 --- a/client/mobile/android/settings.gradle +++ b/client/mobile/android/settings.gradle @@ -1,6 +1,5 @@ rootProject.name = 'Tailchat' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) -include ':app', ':react-native-getui' -project(':react-native-getui').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-getui/android') +include ':app' includeBuild('../node_modules/react-native-gradle-plugin') diff --git a/client/mobile/ios/Podfile.lock b/client/mobile/ios/Podfile.lock index dac12621..b24087ae 100644 --- a/client/mobile/ios/Podfile.lock +++ b/client/mobile/ios/Podfile.lock @@ -73,11 +73,6 @@ PODS: - FlipperKit/FlipperKitNetworkPlugin - fmt (6.2.1) - glog (0.3.5) - - GTSDK (2.7.4.0): - - ZXSDK - - GtSdkRN (1.1.42): - - GTSDK - - React - hermes-engine (0.71.2): - hermes-engine/Pre-built (= 0.71.2) - hermes-engine/Pre-built (0.71.2) @@ -468,7 +463,6 @@ PODS: - Yoga (1.14.0) - YogaKit (1.18.1): - Yoga (~> 1.14) - - ZXSDK (3.2.3) DEPENDENCIES: - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) @@ -497,7 +491,6 @@ DEPENDENCIES: - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0) - FlipperKit/SKIOSNetworkPlugin (= 0.125.0) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - - GtSdkRN (from `../node_modules/react-native-getui`) - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) - libevent (~> 2.1.12) - OpenSSL-Universal (= 1.1.1100) @@ -553,12 +546,10 @@ SPEC REPOS: - Flipper-RSocket - FlipperKit - fmt - - GTSDK - libevent - OpenSSL-Universal - SocketRocket - YogaKit - - ZXSDK EXTERNAL SOURCES: boost: @@ -571,8 +562,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/React/FBReactNativeSpec" glog: :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" - GtSdkRN: - :path: "../node_modules/react-native-getui" hermes-engine: :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" RCT-Folly: @@ -665,8 +654,6 @@ SPEC CHECKSUMS: FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b - GTSDK: f28e6d575e8a1c26e331ce29b0ecac7db39679cc - GtSdkRN: d43bf94df00093d6a19a071080743cb4519bedd1 hermes-engine: 6351580c827b3b03e5f25aadcf989f582d0b0a86 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c @@ -708,7 +695,6 @@ SPEC CHECKSUMS: SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 Yoga: 5b0304b3dbef2b52e078052138e23a19c7dacaef YogaKit: f782866e155069a2cca2517aafea43200b01fd5a - ZXSDK: 3ae8f7f2c5d45b4c1def43e14d930495c5f4d424 PODFILE CHECKSUM: 9aaf3e7752d79b6a889333eec3c3b53e8133916b diff --git a/client/mobile/package.json b/client/mobile/package.json index 448a285e..83eca666 100644 --- a/client/mobile/package.json +++ b/client/mobile/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@formatjs/intl": "^2.6.9", - "@notifee/react-native": "^7.4.0", + "@notifee/react-native": "^7.6.1", "@react-native-async-storage/async-storage": "^1.17.11", "immer": "^9.0.19", "lodash": "^4.17.21", @@ -26,7 +26,6 @@ "react-native": "0.71.2", "react-native-config": "^1.5.0", "react-native-gesture-handler": "^2.9.0", - "react-native-getui": "^1.1.42", "react-native-localize": "^2.2.6", "react-native-reanimated": "^2.14.4", "react-native-ui-lib": "^6.29.1", diff --git a/client/mobile/patches/react-native-getui+1.1.42.patch b/client/mobile/patches/react-native-getui+1.1.42.patch deleted file mode 100644 index bfe33c64..00000000 --- a/client/mobile/patches/react-native-getui+1.1.42.patch +++ /dev/null @@ -1,42 +0,0 @@ -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/notifications/getui.ts b/client/mobile/src/lib/notifications/getui.ts index 79e932f3..29ce8626 100644 --- a/client/mobile/src/lib/notifications/getui.ts +++ b/client/mobile/src/lib/notifications/getui.ts @@ -1,9 +1,13 @@ -import Getui from 'react-native-getui'; +import { NativeModules, Platform } from 'react-native'; + +const GetuiModule = NativeModules.GetuiModule; /** * bind alias with userId * user for server push */ export function bindAlias(userId: string) { - Getui.bindAlias(userId); + if (Platform.OS === 'android') { + GetuiModule.bindAlias(userId); + } } diff --git a/client/mobile/yarn.lock b/client/mobile/yarn.lock index fe74abca..160ff031 100644 --- a/client/mobile/yarn.lock +++ b/client/mobile/yarn.lock @@ -1506,10 +1506,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@notifee/react-native@^7.4.0": - version "7.4.0" - resolved "https://registry.npmmirror.com/@notifee/react-native/-/react-native-7.4.0.tgz#0f20744307bf3b800f7b56eb2d0bbdd474748d09" - integrity sha512-c8pkxDQFRbw0JlUmTb07OTG/4LQHRj8MBodMLwEcO+SvqIxK8ya8zSUEzfdcdWsSVqdoym0v3zpSNroR3Quj/w== +"@notifee/react-native@^7.6.1": + version "7.6.1" + resolved "https://registry.npmmirror.com/@notifee/react-native/-/react-native-7.6.1.tgz#e215428787396ec57ea424106cc88666f7efe70d" + integrity sha512-OjhLPODh6FICYZmF9/0UZbcl2JPaPpcrWi1Cvs/OLFbPSJTIEwPZgXFrCHv/cA3wUX4YQCXreSqQGSVQgvNItQ== "@react-native-async-storage/async-storage@^1.17.11": version "1.17.11" @@ -7143,11 +7143,6 @@ react-native-gesture-handler@^2.9.0: lodash "^4.17.21" prop-types "^15.7.2" -react-native-getui@^1.1.42: - version "1.1.42" - resolved "https://registry.npmmirror.com/react-native-getui/-/react-native-getui-1.1.42.tgz#f4aa1f53e10584d4cf65bec5dd8afd58f08d0055" - integrity sha512-esRbDBI5G99/p7+zHEpm9J8V2oEv2L/xRMv1Voi0yxFcnhWd3i1OTodtnC+k+9lurYqu/A4MhTPL99hZcJ/ROg== - react-native-gradle-plugin@^0.71.14: version "0.71.14" resolved "https://registry.npmmirror.com/react-native-gradle-plugin/-/react-native-gradle-plugin-0.71.14.tgz#cc399662f04fbfcc0e352d03eae1d3efbd5f635a"