1,星锁fix—推送偶发性获取不到DeviceID问题

2,星锁fix—登录报错DeviceInfo不能为空问题
3,星锁集成—荣耀厂商通道以提高推送到达率(已测试通过)
4,星锁集成—vivo厂商通道(待vivo机型测试)
This commit is contained in:
“DaisyWu” 2024-09-04 09:09:40 +08:00
parent fd095031c7
commit c0ab54b994
8 changed files with 97 additions and 49 deletions

View File

@ -180,9 +180,9 @@ android {
OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b", OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b",
OPPO_APPID : "OP-31726001", OPPO_APPID : "OP-31726001",
OPPO_APPSECRET : "OP-05723986bba64183a71530b496922450", OPPO_APPSECRET : "OP-05723986bba64183a71530b496922450",
// VIVO_APPKEY : "vivo的APPKEY", VIVO_APPKEY : "75fe8e570425b714e08d0390b14797cb",
// VIVO_APPID : "vivo的APPID", VIVO_APPID : "105752244",
HONOR_APPID : "110798531", HONOR_APPID : "104458196",
] ]
splits { splits {
abi { abi {
@ -249,5 +249,10 @@ dependencies {
implementation 'com.google.code.gson:gson:2.6.2' implementation 'com.google.code.gson:gson:2.6.2'
implementation 'commons-codec:commons-codec:1.6' implementation 'commons-codec:commons-codec:1.6'
implementation 'androidx.annotation:annotation:1.1.0' implementation 'androidx.annotation:annotation:1.1.0'
// 耀
implementation 'cn.jiguang.sdk.plugin:honor:5.2.3'
//耀 aar SDK jpush-android-xxx-release/third-push/honor/libs 下的 aar 文件单独拷贝一份到应用 module/libs
// implementation(name: 'HiPushSDK-7.0.61.303', ext: 'aar')
// VIVO
implementation 'cn.jiguang.sdk.plugin:vivo:5.2.3'
} }

Binary file not shown.

View File

@ -56,6 +56,8 @@
android:name="android.permission.QUERY_ALL_PACKAGES" android:name="android.permission.QUERY_ALL_PACKAGES"
tools:node="remove" /> tools:node="remove" />
<uses-permission android:name="com.hihonor.permission.sec.SDK_LAUNCHER" />
<application <application
android:name="android.app.Application" android:name="android.app.Application"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
@ -96,6 +98,46 @@
<meta-data <meta-data
android:name="OPPO_APPSECRET" android:name="OPPO_APPSECRET"
android:value="OP-05723986bba64183a71530b496922450" /> android:value="OP-05723986bba64183a71530b496922450" />
<meta-data
android:name="com.huawei.hms.client.appid"
android:value="110798531" />
<meta-data
android:name="com.huawei.hms.client.cpid"
android:value="1406555529261648640" />
<meta-data
android:name="OPPO_APPKEY"
android:value="OP-47f668c9943248118502aa58d066393b" />
<meta-data
android:name="OPPO_APPID"
android:value="OP-31726001" />
<meta-data
android:name="OPPO_APPSECRET"
android:value="OP-05723986bba64183a71530b496922450" />
<service
android:name="com.huawei.hms.push.HmsMessageService"
android:exported="true">
<intent-filter>
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver
android:name="com.huawei.hms.support.api.push.PushReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.huawei.android.push.intent.REGISTRATION" />
<action android:name="com.huawei.android.push.intent.RECEIVE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<!-- 配置定位Service --> <!-- 配置定位Service -->
<service android:name="com.amap.api.location.APSService" /> <service android:name="com.amap.api.location.APSService" />
<!-- since JPushv3.6.8 oppov2.1.0 oppo 核心功能--> <!-- since JPushv3.6.8 oppov2.1.0 oppo 核心功能-->

View File

@ -19,7 +19,12 @@ class StarLockLoginState {
FocusNode emailOrPhoneFocusNode = FocusNode(); FocusNode emailOrPhoneFocusNode = FocusNode();
FocusNode pwdFocusNode = FocusNode(); FocusNode pwdFocusNode = FocusNode();
RxMap<String, dynamic> deviceInfoMap = <String, dynamic>{}.obs; RxMap<String, dynamic> deviceInfoMap = <String, dynamic>{
'deviceBrand': '暂无',
'deviceModel': '暂无',
'deviceVersion': '暂无',
'deviceType': 0
}.obs;
StarLockLoginState() { StarLockLoginState() {
// emailOrPhone.value = StoreService.to.getLastUserAccount() as String; // emailOrPhone.value = StoreService.to.getLastUserAccount() as String;

View File

@ -57,7 +57,6 @@ class StarLockRegisterLogic extends BaseGetXController {
Storage.saveLoginData(entity.data); Storage.saveLoginData(entity.data);
Storage.setBool(saveIsVip, entity.data!.isVip == 1); Storage.setBool(saveIsVip, entity.data!.isVip == 1);
eventBus.fire(MineInfoChangeRefreshUI()); eventBus.fire(MineInfoChangeRefreshUI());
XSJPushProvider().bindDeviceID();
XSJPushProvider().initLocalNotification(isCancelLocalPush: false); XSJPushProvider().initLocalNotification(isCancelLocalPush: false);
Get.offNamedUntil(Routers.starLockMain, (Route route) => false); Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
BlueManage().scanDevices.clear(); // BlueManage().scanDevices.clear(); //

View File

@ -29,8 +29,10 @@ class LockMainLogic extends BaseGetXController {
final List<StreamSubscription<void>> _subscriptions = final List<StreamSubscription<void>> _subscriptions =
<StreamSubscription<void>>[]; <StreamSubscription<void>>[];
Future<LockListInfoEntity> getStarLockInfo({bool isUnShowLoading = false}) async { Future<LockListInfoEntity> getStarLockInfo(
final LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo( {bool isUnShowLoading = false}) async {
final LockListInfoEntity entity =
await ApiRepository.to.getStarLockListInfo(
pageNo: pageNo, pageNo: pageNo,
pageSize: 50, pageSize: 50,
isUnShowLoading: isUnShowLoading, isUnShowLoading: isUnShowLoading,
@ -44,13 +46,12 @@ class LockMainLogic extends BaseGetXController {
} }
Future<LoginEntity> updateZoneOffsetsAndLanguages() async { Future<LoginEntity> updateZoneOffsetsAndLanguages() async {
final LoginEntity entity = await ApiRepository.to.updateZoneOffsetsAndLanguages( final LoginEntity entity =
await ApiRepository.to.updateZoneOffsetsAndLanguages(
timezoneOffset: DateTime.now().timeZoneOffset.inSeconds, timezoneOffset: DateTime.now().timeZoneOffset.inSeconds,
// language: '' // language: ''
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {}
}
return entity; return entity;
} }
@ -88,18 +89,22 @@ class LockMainLogic extends BaseGetXController {
}); });
} }
if(state.dataLength.value == 1){ if (state.dataLength.value == 1) {
if (Get.isRegistered<LockDetailLogic>()) { if (Get.isRegistered<LockDetailLogic>()) {
// //
// AppLog.log('检测控制器是否存 调用了 setLockListInfoGroupEntity'); // AppLog.log('检测控制器是否存 调用了 setLockListInfoGroupEntity');
Get.find<LockDetailLogic>().loadData(lockListInfoItemEntity: entity.groupList![0].lockList![0], isOnlyOneData: true); Get.find<LockDetailLogic>().loadData(
lockListInfoItemEntity: entity.groupList![0].lockList![0],
isOnlyOneData: true);
} else { } else {
// //
Future<dynamic>.delayed(200.milliseconds, () { Future<dynamic>.delayed(200.milliseconds, () {
if (Get.isRegistered<LockDetailLogic>()) { if (Get.isRegistered<LockDetailLogic>()) {
// //
// AppLog.log('检测控制器是否存 延迟调用了 setLockListInfoGroupEntity'); // AppLog.log('检测控制器是否存 延迟调用了 setLockListInfoGroupEntity');
Get.find<LockDetailLogic>().loadData(lockListInfoItemEntity: entity.groupList![0].lockList![0], isOnlyOneData: true); Get.find<LockDetailLogic>().loadData(
lockListInfoItemEntity: entity.groupList![0].lockList![0],
isOnlyOneData: true);
} }
}); });
} }
@ -301,7 +306,6 @@ class LockMainLogic extends BaseGetXController {
// JPush服务并绑定设备ID // JPush服务并绑定设备ID
final XSJPushProvider jpushProvider = XSJPushProvider(); final XSJPushProvider jpushProvider = XSJPushProvider();
await jpushProvider.initJPushService(); await jpushProvider.initJPushService();
await jpushProvider.bindDeviceID();
await jpushProvider.initLocalNotification(isCancelLocalPush: false); await jpushProvider.initLocalNotification(isCancelLocalPush: false);
// UDP // UDP

View File

@ -61,7 +61,6 @@ class LockMainXHJLogic extends BaseGetXController {
// JPush服务并绑定设备ID // JPush服务并绑定设备ID
final XSJPushProvider jpushProvider = XSJPushProvider(); final XSJPushProvider jpushProvider = XSJPushProvider();
await jpushProvider.initJPushService(); await jpushProvider.initJPushService();
await jpushProvider.bindDeviceID();
await jpushProvider.initLocalNotification(isCancelLocalPush: false); await jpushProvider.initLocalNotification(isCancelLocalPush: false);
} }

View File

@ -49,39 +49,33 @@ class XSJPushProvider {
// //
void addJPushEventHandler() { void addJPushEventHandler() {
jpush.addEventHandler( jpush.addEventHandler(
onReceiveNotification: (Map<String, dynamic> message) async { onReceiveNotification: (Map<String, dynamic> message) async {
AppLog.log('onReceiveNotification: $message'); AppLog.log('onReceiveNotification: $message');
}, onOpenNotification: (Map<String, dynamic> message) async { },
AppLog.log('onOpenNotification: $message'); onOpenNotification: (Map<String, dynamic> message) async {
}, onReceiveMessage: (Map<String, dynamic> message) async { AppLog.log('onOpenNotification: $message');
AppLog.log('onReceiveMessage: $message'); },
// onReceiveMessage: (Map<String, dynamic> message) async {
MessageManagement.shunting(message); AppLog.log('onReceiveMessage: $message');
}, onReceiveNotificationAuthorization: //
(Map<String, dynamic> message) async { MessageManagement.shunting(message);
AppLog.log('onReceiveNotificationAuthorization: $message'); },
}, onInAppMessageShow: (Map<String, dynamic> message) async { onReceiveNotificationAuthorization: (Map<String, dynamic> message) async {
AppLog.log('onInAppMessageShow: $message'); AppLog.log('onReceiveNotificationAuthorization: $message');
}); },
} onInAppMessageShow: (Map<String, dynamic> message) async {
AppLog.log('onInAppMessageShow: $message');
},
onConnected: (Map<String, dynamic> message) async {
//id
final String rid = await jpush.getRegistrationID();
AppLog.log('onConnected registration id : $rid');
await Storage.setString(pushDeviceID, rid);
await pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
//ID return Future.value();
Future<void> bindDeviceID() async { },
try { );
AppLog.log('Fetching registration ID...');
String rid;
rid = await jpush.getRegistrationID();
if (rid.isEmpty) {
AppLog.log('Registration ID is empty.');
rid = await jpush.getRegistrationID();
return;
}
AppLog.log('flutter get registration id : $rid');
await Storage.setString(pushDeviceID, rid);
await pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
} catch (e) {
AppLog.log('Error getting registration ID: $e');
}
} }
Future<void> pushBindDeviceID(String deviceID, int deviceType) async { Future<void> pushBindDeviceID(String deviceID, int deviceType) async {