Merge branch 'release' of https://gitee.com/starlock-cn/app-starlock into release
This commit is contained in:
commit
ee97a645f7
@ -59,11 +59,6 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
}
|
||||
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
||||
BlueManage().scanDevices.clear(); //清除设备缓存
|
||||
// 初始化JPush服务并绑定设备ID
|
||||
final XSJPushProvider jpushProvider = XSJPushProvider();
|
||||
await jpushProvider.initJPushService();
|
||||
await jpushProvider.bindDeviceID();
|
||||
await jpushProvider.initLocalNotification(isCancelLocalPush: false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +106,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
//刷新设备信息
|
||||
void flushedDeviceInfo() {
|
||||
Future<void> flushedDeviceInfo() async {
|
||||
XSConstantMacro().getDeviceInfoData().then((Map<String, dynamic> data) {
|
||||
state.deviceInfoMap.value = data;
|
||||
}).catchError((dynamic error) {
|
||||
|
||||
@ -50,16 +50,29 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
await ApiRepository.to.updateLockNoticeSettingAccount(
|
||||
lockNoticeSettingAccountId: state.familyData.value.id!,
|
||||
settingValue: {
|
||||
'openDoorId': state.familyData.value.settingValue!.openDoorId!,
|
||||
'openDoorType': state.familyData.value.settingValue!.openDoorType!,
|
||||
'remark': state.changeNameController.text,
|
||||
'openDoorId': state.isDetail.value
|
||||
? state.lockUserKeys.value.currentOpenDoorID
|
||||
: state.familyData.value.settingValue!.openDoorId!,
|
||||
'openDoorType': state.isDetail.value
|
||||
? state.lockUserKeys.value.currentKeyType
|
||||
: state.familyData.value.settingValue!.openDoorType!,
|
||||
'remark': state.isDetail.value
|
||||
? state.lockUserKeys.value.currentKeyName
|
||||
: state.changeNameController.text,
|
||||
'noticeWay': state.familyData.value.settingValue!.noticeWayList,
|
||||
},
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('更新成功'.tr);
|
||||
state.lockUserKeys.value.currentKeyName = state.changeNameController.text;
|
||||
Get.back(result: true);
|
||||
if (!state.isDetail.value) {
|
||||
state.lockUserKeys.value.currentKeyName =
|
||||
state.changeNameController.text;
|
||||
state.lockUserKeys.refresh();
|
||||
|
||||
Get.back(result: true);
|
||||
} else {
|
||||
state.lockUserKeys.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,11 +48,16 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
//锁用户
|
||||
Get.toNamed(Routers.lockUserPage, arguments: <String, int>{
|
||||
'getLockId': state.getLockId.value
|
||||
Get.toNamed(Routers.lockUserPage, arguments: {
|
||||
'getLockId': state.getLockId.value,
|
||||
'openDoorId': state.openDoorId.value,
|
||||
})?.then((val) {
|
||||
if (val != null) {
|
||||
state.lockUserKeys.value = val;
|
||||
|
||||
if (state.isDetail.value) {
|
||||
logic.updateLockNoticeSetting();
|
||||
}
|
||||
}
|
||||
});
|
||||
})),
|
||||
@ -169,7 +174,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
);
|
||||
}
|
||||
|
||||
//修改家人名称弹窗
|
||||
//修改家人名称弹窗
|
||||
void showCupertinoAlertDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
@ -179,6 +184,10 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
|
||||
tipTitle: '请输入'.tr,
|
||||
controller: state.changeNameController,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(50),
|
||||
],
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
if (state.changeNameController.text.isNotEmpty) {
|
||||
|
||||
@ -4,21 +4,8 @@ import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.d
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
|
||||
|
||||
class AddFamilyState {
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
RxInt getLockId = 0.obs;
|
||||
Rx<LockUserListKeys> lockUserKeys = LockUserListKeys().obs;
|
||||
RxList emailReceiverList = [].obs;
|
||||
var phoneReceiverList = [].obs;
|
||||
var emailListStr = ''.obs;
|
||||
var phontListStr = ''.obs;
|
||||
|
||||
var openDoorId = 0.obs;
|
||||
var openDoorType = 0.obs;
|
||||
var familyData = DataList().obs;
|
||||
var isDetail = false.obs;
|
||||
|
||||
AddFamilyState() {
|
||||
Map map = Get.arguments;
|
||||
final Map map = Get.arguments;
|
||||
if (map['lockId'] != null) {
|
||||
getLockId.value = map['lockId'];
|
||||
}
|
||||
@ -31,6 +18,19 @@ class AddFamilyState {
|
||||
familyData.value = map['itemData'];
|
||||
lockUserKeys.value.currentKeyName =
|
||||
familyData.value.settingValue!.remark!;
|
||||
openDoorId.value = familyData.value.settingValue!.openDoorId!;
|
||||
}
|
||||
}
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
RxInt getLockId = 0.obs;
|
||||
Rx<LockUserListKeys> lockUserKeys = LockUserListKeys().obs;
|
||||
RxList emailReceiverList = [].obs;
|
||||
RxList phoneReceiverList = [].obs;
|
||||
RxString emailListStr = ''.obs;
|
||||
RxString phontListStr = ''.obs;
|
||||
|
||||
RxInt openDoorId = 0.obs;
|
||||
RxInt openDoorType = 0.obs;
|
||||
Rx<DataList> familyData = DataList().obs;
|
||||
RxBool isDetail = false.obs;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
@ -73,6 +74,17 @@ class LockUserLogic extends BaseGetXController {
|
||||
state.lockUserList.addAll(data5.lockUserList!);
|
||||
|
||||
state.lockUserList.refresh();
|
||||
|
||||
if (state.selectedOpenDoorId.value != null) {
|
||||
for (int i = 0; i < state.lockUserList.length; i++) {
|
||||
if (state.lockUserList[i].currentOpenDoorID ==
|
||||
state.selectedOpenDoorId.value) {
|
||||
state.isSelectIndex.value = i;
|
||||
state.isSelectIndex.refresh();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
final LockUserState state = Get.find<LockUserLogic>().state;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
logic.getLockKeysList();
|
||||
@ -86,7 +86,7 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
if (selectIndex == i) {
|
||||
item.isCurrentSelect = true;
|
||||
} else {
|
||||
item.isCurrentSelect = true;
|
||||
item.isCurrentSelect = false;
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
@ -144,13 +144,13 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
state.isSelectIndex.value == selectIndex
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
),
|
||||
Obx(() => Image.asset(
|
||||
state.isSelectIndex.value == selectIndex
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
)),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
),
|
||||
|
||||
@ -3,17 +3,21 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
|
||||
|
||||
class LockUserState {
|
||||
TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框
|
||||
var isSelectUser = false.obs;
|
||||
var isSelectIndex = 0.obs;
|
||||
|
||||
var getLockId = 0.obs;
|
||||
var lockUserList = <LockUserListKeys>[].obs; //锁所有用户列表
|
||||
//锁所有用户列表
|
||||
|
||||
LockUserState() {
|
||||
Map map = Get.arguments;
|
||||
final Map map = Get.arguments;
|
||||
if (map['getLockId'] != null) {
|
||||
getLockId.value = map['getLockId'];
|
||||
}
|
||||
|
||||
selectedOpenDoorId.value = map['openDoorId'];
|
||||
}
|
||||
TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框
|
||||
RxBool isSelectUser = false.obs;
|
||||
RxInt selectedOpenDoorId = 0.obs;
|
||||
RxInt isSelectIndex = 0.obs;
|
||||
|
||||
RxInt getLockId = 0.obs;
|
||||
RxList<LockUserListKeys> lockUserList = <LockUserListKeys>[].obs;
|
||||
}
|
||||
|
||||
@ -24,57 +24,60 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
logic.lockNoticeSettingAccountList();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '家人到家'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_topTipsWidget(),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '家人到家'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_topTipsWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
Expanded(
|
||||
child: Obx(
|
||||
() => state.openDoorNotifyList.value.isNotEmpty
|
||||
? _buildMainUI()
|
||||
: NoData(),
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(() => state.openDoorNotifyList.value.isNotEmpty
|
||||
? _buildMainUI()
|
||||
: NoData())),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: '添加家人'.tr,
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.addFamilyPage, arguments: {
|
||||
'lockId': state.getLockId.value,
|
||||
'isDetail': false
|
||||
})?.then((value) {
|
||||
if (value != null) {
|
||||
logic.lockNoticeSettingAccountList();
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
));
|
||||
),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: '添加家人'.tr,
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.addFamilyPage, arguments: {
|
||||
'lockId': state.getLockId.value,
|
||||
'isDetail': false,
|
||||
})?.then((value) {
|
||||
if (value != null) {
|
||||
logic.lockNoticeSettingAccountList();
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(height: 64.h),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _topTipsWidget() {
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
child: Text(
|
||||
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。'.tr,
|
||||
style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 20.sp),
|
||||
));
|
||||
alignment: Alignment.centerLeft,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
child: Text(
|
||||
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。'.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor,
|
||||
fontSize: 20.sp,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
@ -99,11 +102,9 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
||||
Get.toNamed(Routers.addFamilyPage, arguments: {
|
||||
'itemData': itemData,
|
||||
'lockId': state.getLockId.value,
|
||||
'isDetail': true
|
||||
'isDetail': true,
|
||||
})?.then((value) {
|
||||
if (value != null) {
|
||||
logic.lockNoticeSettingAccountList();
|
||||
}
|
||||
logic.lockNoticeSettingAccountList();
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
@ -111,33 +112,30 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
||||
height: 90.h,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
SizedBox(width: 30.w),
|
||||
Image.asset(
|
||||
'images/controls_user.png',
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
itemData.settingValue!.remark ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 20.w,
|
||||
))
|
||||
child: Text(
|
||||
itemData.settingValue!.remark ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: AppColors.blackColor,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
@ -147,8 +145,9 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
||||
Text(
|
||||
logic.getKeyTypeStr(itemData),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -135,6 +135,7 @@ class LockListLogic extends BaseGetXController {
|
||||
String getKeyEffective(LockListInfoItemEntity keyInfo) {
|
||||
// 当是限时、循环的时候
|
||||
if (keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLong ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
// 当是正常使用跟待接收状态的时候
|
||||
if (keyInfo.keyStatus == XSConstantMacro.keyStatusNormalUse ||
|
||||
@ -158,6 +159,11 @@ class LockListLogic extends BaseGetXController {
|
||||
XSConstantMacro.keyStatusFrozen,
|
||||
XSConstantMacro.keyStatusExpired,
|
||||
];
|
||||
|
||||
//新增以上组合未包含--永久&&冻结状态 显示
|
||||
final bool isLongFrozenStatus =
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLong &&
|
||||
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen;
|
||||
final DateTime endDate =
|
||||
DateTime.fromMillisecondsSinceEpoch(keyInfo.endDate ?? 0);
|
||||
final DateTime now = DateTime.now();
|
||||
@ -165,7 +171,8 @@ class LockListLogic extends BaseGetXController {
|
||||
final bool isKeyStatus = keyStatus.contains(keyInfo.keyStatus);
|
||||
final Duration difference = endDate.difference(now);
|
||||
final bool isExpirationSoon = isKeyType && difference.inDays <= 15;
|
||||
final bool isShow = isKeyType && isKeyStatus || isExpirationSoon;
|
||||
final bool isShow =
|
||||
isKeyType && isKeyStatus || isExpirationSoon || isLongFrozenStatus;
|
||||
return isShow;
|
||||
}
|
||||
|
||||
|
||||
@ -110,6 +110,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
||||
return;
|
||||
}
|
||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLong ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
|
||||
logic.showToast('您的钥匙已冻结'.tr);
|
||||
@ -143,12 +144,16 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
||||
? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w)
|
||||
: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
decoration: BoxDecoration(
|
||||
color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusWaitIneffective ||
|
||||
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
||||
keyInfo.keyStatus == XSConstantMacro.keyStatusExpired))
|
||||
color: (((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusWaitIneffective ||
|
||||
keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusFrozen ||
|
||||
keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusExpired)) ||
|
||||
(keyInfo.keyType == XSConstantMacro.keyTypeLong &&
|
||||
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen))
|
||||
? AppColors.greyBackgroundColor
|
||||
: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20.w),
|
||||
|
||||
@ -209,6 +209,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
return;
|
||||
}
|
||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLong ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
|
||||
logic.showToast('您的钥匙已冻结'.tr);
|
||||
@ -255,12 +256,16 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
onTap: action,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusWaitIneffective ||
|
||||
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
||||
keyInfo.keyStatus == XSConstantMacro.keyStatusExpired))
|
||||
color: (((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusWaitIneffective ||
|
||||
keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusFrozen ||
|
||||
keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusExpired)) ||
|
||||
(keyInfo.keyType == XSConstantMacro.keyTypeLong &&
|
||||
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen))
|
||||
? AppColors.greyBackgroundColor
|
||||
: Colors.white.withOpacity(0.8),
|
||||
borderRadius: BorderRadius.circular(20.w),
|
||||
|
||||
@ -11,6 +11,7 @@ import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_logic.dart';
|
||||
import 'package:star_lock/main/lockMian/lockList/lockList_logic.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
import 'package:star_lock/tools/push/xs_jPhush.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../app_settings/app_settings.dart';
|
||||
@ -267,8 +268,14 @@ class LockMainLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
Future<void> onReady() async {
|
||||
super.onReady();
|
||||
// 初始化JPush服务并绑定设备ID
|
||||
final XSJPushProvider jpushProvider = XSJPushProvider();
|
||||
await jpushProvider.initJPushService();
|
||||
await jpushProvider.bindDeviceID();
|
||||
await jpushProvider.initLocalNotification(isCancelLocalPush: false);
|
||||
|
||||
// 开启UDP
|
||||
UdpHelp().openUDP();
|
||||
BlueManage();
|
||||
|
||||
@ -69,7 +69,13 @@ class XSJPushProvider {
|
||||
Future<void> bindDeviceID() async {
|
||||
try {
|
||||
AppLog.log('Fetching registration ID...');
|
||||
final String rid = await jpush.getRegistrationID();
|
||||
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user