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

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

View File

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