修复偶现无法收到推送问题

This commit is contained in:
“DaisyWu” 2024-07-25 18:33:27 +08:00
parent 8401514838
commit 811b3ea356
3 changed files with 38 additions and 18 deletions

View File

@ -1,4 +1,3 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -41,7 +40,6 @@ class StarLockRegisterLogic extends BaseGetXController {
} }
Future<void> register() async { Future<void> register() async {
AppLog.log( AppLog.log(
'state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}'); 'state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}');
if (state.pwd.value != state.surePwd.value) { if (state.pwd.value != state.surePwd.value) {
@ -67,25 +65,27 @@ class StarLockRegisterLogic extends BaseGetXController {
} }
Future<void> sendValidationCode() async { Future<void> sendValidationCode() async {
final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeUnLogin( final SendValidationCodeEntity entity =
// state.countryCode.value, await ApiRepository.to.sendValidationCodeUnLogin(
countryCode: state.countryCode.value.toString(), // state.countryCode.value,
account: state.phoneOrEmailStr.value, countryCode: state.countryCode.value.toString(),
channel: state.isIphoneType.value ? '1' : '2', account: state.phoneOrEmailStr.value,
codeType: '1', channel: state.isIphoneType.value ? '1' : '2',
xWidth: state.xWidth.value.toString()); codeType: '1',
xWidth: state.xWidth.value.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
_startTimer(); _startTimer();
} else {} } else {}
} }
Future<void> checkIpAction() async { Future<void> checkIpAction() async {
final CheckIPEntity entity = await ApiRepository.to.checkIpAction( final CheckIPEntity entity = await ApiRepository.to.checkIpAction(ip: '');
ip: ''
);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if(state.countryName.value == entity.data!.name){ if (state.countryName.value == entity.data!.name) {
ShowTipView().showSureAlertDialog('国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续'.tr, tipTitle: '确认国家或地区'.tr, sureStr: '我知道了'.tr); ShowTipView().showSureAlertDialog(
'国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续'.tr,
tipTitle: '确认国家或地区'.tr,
sureStr: '我知道了'.tr);
} }
} }
} }

View File

@ -8,6 +8,7 @@ import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_state.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/push/xs_jPhush.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
class LockMainXHJLogic extends BaseGetXController { class LockMainXHJLogic extends BaseGetXController {
@ -18,13 +19,18 @@ class LockMainXHJLogic extends BaseGetXController {
update(); update();
} }
bool get isMall => state.index ==1; bool get isMall => state.index == 1;
// //
Future<void> getUserInfoRequest() async { Future<void> getUserInfoRequest() async {
final MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo(); final MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo();
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
Storage.setBool(saveIsVip, entity.data!.isVip==1); Storage.setBool(saveIsVip, entity.data!.isVip == 1);
if (entity.data!.deviceId != null) {
if (entity.data!.deviceId!.isEmpty) {
bindDevice();
}
}
} }
} }
@ -51,9 +57,19 @@ class LockMainXHJLogic extends BaseGetXController {
}); });
} }
Future<void> bindDevice() async {
// JPush服务并绑定设备ID
final XSJPushProvider jpushProvider = XSJPushProvider();
await jpushProvider.initJPushService();
await jpushProvider.bindDeviceID();
await jpushProvider.initLocalNotification(isCancelLocalPush: false);
}
@override @override
void onReady() { Future<void> onReady() async {
super.onReady(); super.onReady();
bindDevice();
} }
@override @override

View File

@ -38,6 +38,7 @@ class MinePersonInfoData {
String? email; String? email;
String? countryName; String? countryName;
int? isVip; int? isVip;
String? deviceId;
MinePersonInfoData( MinePersonInfoData(
{this.mobile, {this.mobile,
@ -49,7 +50,8 @@ class MinePersonInfoData {
this.countryId, this.countryId,
this.email, this.email,
this.countryName, this.countryName,
this.isVip}); this.isVip,
this.deviceId});
MinePersonInfoData.fromJson(Map<String, dynamic> json) { MinePersonInfoData.fromJson(Map<String, dynamic> json) {
mobile = json['mobile']; mobile = json['mobile'];
@ -62,6 +64,7 @@ class MinePersonInfoData {
email = json['email']; email = json['email'];
countryName = json['countryName']; countryName = json['countryName'];
isVip = json['isVip']; isVip = json['isVip'];
deviceId = json['deviceId'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -76,6 +79,7 @@ class MinePersonInfoData {
data['email'] = email; data['email'] = email;
data['countryName'] = countryName; data['countryName'] = countryName;
data['isVip'] = isVip; data['isVip'] = isVip;
data['deviceId'] = deviceId;
return data; return data;
} }
} }