diff --git a/.DS_Store b/.DS_Store index 82334faf..c45cb79e 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/star_lock/lib/main/lockDetail/card/addICCard/addICCard_page.dart b/star_lock/lib/main/lockDetail/card/addICCard/addICCard_page.dart index eeeebcf8..97e0d039 100644 --- a/star_lock/lib/main/lockDetail/card/addICCard/addICCard_page.dart +++ b/star_lock/lib/main/lockDetail/card/addICCard/addICCard_page.dart @@ -101,7 +101,6 @@ class _AddICCardPageState extends State with RouteAware { super.didPop(); print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; } @@ -121,7 +120,6 @@ class _AddICCardPageState extends State with RouteAware { logic.cancelBlueConnetctToastTimer(); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; } } diff --git a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart index eb8b2ff6..7b7f39be 100644 --- a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart @@ -69,7 +69,7 @@ class CardDetailLogic extends BaseGetXController{ userID:await Storage.getUid(), cardNo:int.parse(state.typeNumber.value), useCountLimit:state.isDeletCard.value == true ? 0 : 0xff, - isForce:state.isStressFingerprint.value == true ? 1 : 0, // 是否是胁迫 + isForce:state.isStressCard.value == true ? 1 : 0, // 是否是胁迫 isRound:state.keyType.value == 4 ? 1: 0, // 是否是循环 weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环 startDate: int.parse(state.startDate.value)~/1000, @@ -103,9 +103,6 @@ class CardDetailLogic extends BaseGetXController{ }); BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ - // var publicKey = await Storage.getStringList(saveBluePublicKey); - // List publicKeyDataList = changeStringListToIntList(publicKey!); - var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); @@ -120,7 +117,7 @@ class CardDetailLogic extends BaseGetXController{ userID:await Storage.getUid(), cardNo:int.parse(state.typeNumber.value), useCountLimit:state.isDeletCard.value == true ? 0 : 0xff, - isForce:state.isStressFingerprint.value == true ? 1 : 0, // 是否是胁迫 + isForce:state.isStressCard.value == true ? 1 : 0, // 是否是胁迫 isRound:state.keyType.value == 4 ? 1: 0, // 是否是循环 weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环 startDate: int.parse(state.startDate.value)~/1000, @@ -132,19 +129,6 @@ class CardDetailLogic extends BaseGetXController{ privateKey:getPrivateKeyList, token: getTokenList, ); - - // IoSenderManage.senderAddCardWithTimeCycleCoercionCommand( - // keyID:state.keyId.value.toString(), - // userID:userID, - // cardNo:int.parse(state.typeNumber.value), - // useCountLimit:0, - // startTime:int.parse(state.starDate.value), - // endTime:int.parse(state.endDate.value), - // needAuthor:1, - // signKey:signKeyDataList, - // privateKey:getPrivateKeyList, - // token: getTokenList, - // ); } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { dismissEasyLoading(); cancelBlueConnetctToastTimer(); @@ -164,7 +148,7 @@ class CardDetailLogic extends BaseGetXController{ weekDay: state.weekDay.value, startDate: state.startDate.value, endDate: state.endDate.value, - isCoerced: state.isStressFingerprint.value ? "2" : "1", + isCoerced: state.isStressCard.value ? "2" : "1", cardName: state.changeNameController.text, changeType: "1", startTime: int.parse(state.starTime.value), diff --git a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart index 3981599e..6785498e 100644 --- a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart +++ b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart @@ -51,7 +51,18 @@ class _CardDetailPageState extends State with RouteAware { isHaveDirection: true, isHaveLine: true, action: () { - showCupertinoAlertDialog(context); + ShowTipView().showTFViewAlertDialog( + state.changeNameController, + "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", + "", (){ + if(state.changeNameController.text.isEmpty){ + logic.showToast("请输入姓名".tr); + return; + } + Get.back(); + state.typeName.value = state.changeNameController.text; + logic.editICCardData(); + }); })), Obx(() => Visibility( visible: (state.keyType.value == 4 || state.keyType.value == 2 || state.keyType.value == 1) ? true : false, @@ -188,10 +199,10 @@ class _CardDetailPageState extends State with RouteAware { activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, - value: state.isStressFingerprint.value, + value: state.isStressCard.value, onChanged: (value) { setState(() { - state.isStressFingerprint.value = value; + state.isStressCard.value = value; state.isDeletCard.value = false; logic.senderAddICCard(); }); @@ -199,48 +210,6 @@ class _CardDetailPageState extends State with RouteAware { ); } - void showCupertinoAlertDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return ShowTFView( - title: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", - tipTitle: "", - controller: state.changeNameController, - sureClick: () { - if(state.changeNameController.text.isEmpty){ - logic.showToast("请输入姓名".tr); - return; - } - Get.back(); - state.typeName.value = state.changeNameController.text; - logic.editICCardData(); - }, - cancelClick: () { - Get.back(); - },); - }); - } - - // void showIosTipViewDialog(BuildContext context) { - // showDialog( - // context: context, - // builder: (BuildContext context) { - // return ShowIosTipView( - // title: "提示", - // tipTitle: "确定要删除吗?", - // sureClick: () async { - // Get.back(); - // logic.senderAddICCard(); - // }, - // cancelClick: () { - // Get.back(); - // }, - // ); - // } - // ); - // } - @override void didChangeDependencies() { // TODO: implement didChangeDependencies @@ -270,10 +239,8 @@ class _CardDetailPageState extends State with RouteAware { @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -282,7 +249,6 @@ class _CardDetailPageState extends State with RouteAware { @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -290,10 +256,8 @@ class _CardDetailPageState extends State with RouteAware { @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_state.dart b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_state.dart index 07f83e08..0d9683b9 100644 --- a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_state.dart +++ b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_state.dart @@ -13,7 +13,7 @@ class CardDetailState{ var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) var isDeletCard = true.obs;// 是否删除卡 - var isStressFingerprint = false.obs;// 是否胁迫 + var isStressCard = false.obs;// 是否胁迫 final typeNumber = "".obs;// 指纹号 final typeName = "".obs;// 指纹名字 @@ -42,8 +42,7 @@ class CardDetailState{ keyType.value = fingerprintItemData.value.cardType!; adder.value = fingerprintItemData.value.senderUsername!; addTime.value = fingerprintItemData.value.createDate!; - isStressFingerprint.value = fingerprintItemData.value.isCoerced! == 2 ? true : false; - + isStressCard.value = fingerprintItemData.value.isCoerced! == 2 ? true : false; weekDay.value = fingerprintItemData.value.weekDay!; } } diff --git a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart index b6230240..4e1c399c 100644 --- a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart +++ b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart @@ -331,10 +331,8 @@ class _CardListPageState extends State with RouteAware { @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; } @@ -342,7 +340,6 @@ class _CardListPageState extends State with RouteAware { @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -350,10 +347,8 @@ class _CardListPageState extends State with RouteAware { @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; } } diff --git a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart index 15c9430e..9091685c 100644 --- a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart +++ b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart @@ -1,33 +1,364 @@ +import 'dart:async'; + +import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; +import 'package:star_lock/blue/io_type.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import '../../../../blue/blue_manage.dart'; +import '../../../../blue/io_protocol/io_addFace.dart'; +import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart'; +import '../../../../blue/io_protocol/io_addICCardWithTimeCycleCoercion.dart'; +import '../../../../blue/io_reply.dart'; +import '../../../../blue/io_tool/io_tool.dart'; +import '../../../../blue/io_tool/manager_event_bus.dart'; +import '../../../../blue/sender_manage.dart'; import '../../../../network/api_repository.dart'; import '../../../../tools/dateTool.dart'; import '../../../../tools/eventBusEventManage.dart'; +import '../../../../tools/storage.dart'; import 'otherTypeKeyChangeDate_state.dart'; class OtherTypeKeyChangeDateLogic extends BaseGetXController{ OtherTypeKeyChangeDateState state = OtherTypeKeyChangeDateState(); + // 监听设备返回的数据 + late StreamSubscription _replySubscription; + void _initReplySubscription() { + _replySubscription = EventBusManager().eventBus!.on().listen((reply) async { + // 添加卡片开始(重置锁里面所有卡) + if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) { + _replyAddICCardBegin(reply); + } + + // 添加指纹开始(此处用作修改或者删除指纹) + if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) { + _replyAddFingerprintBegin(reply); + } + + // 添加人脸开始(此处用作修改人脸) + if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) { + _replyAddFaceBegin(reply); + } + }); + } + + // 添加人脸开始 + Future _replyAddFaceBegin(Reply reply) async { + int status = reply.data[2]; + print("status:$status"); + + switch (status) { + case 0x00: + //成功 + Get.log("${reply.commandType!.typeValue} 删除人脸数据解析成功"); + state.sureBtnState.value = 0; + cancelBlueConnetctToastTimer(); + dismissEasyLoading(); + editFaceData(); + break; + case 0x06: + //无权限 + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var signKey = await Storage.getStringList(saveBlueSignKey); + List signKeyDataList = changeStringListToIntList(signKey!); + + var token = reply.data.sublist(5, 9); + var saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + IoSenderManage.senderAddFaceCommand( + keyID:state.fingerprintItemData.value.cardId!.toString(), + userID:await Storage.getUid(), + faceNo:int.parse(state.fingerprintItemData.value.faceNumber!), + useCountLimit:0xff, + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:0, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环 + startDate: state.fingerprintItemData.value.startDate!~/1000, + endDate: state.fingerprintItemData.value.endDate!~/1000, + startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()), + endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()), + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: token, + ); + break; + default: + //失败 + break; + } + } + + // 删除/修改人脸信息 + Future senderAddFace() async { + if (state.sureBtnState.value == 1) { + return; + } + state.sureBtnState.value = 1; + + showEasyLoading(); + showBlueConnetctToastTimer(action: () { + dismissEasyLoading(); + state.sureBtnState.value = 0; + }); + BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var token = await Storage.getStringList(saveBlueToken); + List getTokenList = changeStringListToIntList(token!); + + var signKey = await Storage.getStringList(saveBlueSignKey); + List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.senderAddFaceCommand( + keyID:state.fingerprintItemData.value.cardId!.toString(), + userID:await Storage.getUid(), + faceNo:int.parse(state.fingerprintItemData.value.faceNumber!), + useCountLimit:0xff, + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:0, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环 + startDate: state.fingerprintItemData.value.startDate!~/1000, + endDate: state.fingerprintItemData.value.endDate!~/1000, + startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()), + endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()), + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: getTokenList, + ); + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { + dismissEasyLoading(); + cancelBlueConnetctToastTimer(); + state.sureBtnState.value = 0; + if (state.ifCurrentScreen.value == true) { + showBlueConnetctToast(); + } + } + }); + } + + // 添加卡片开始(此处用作删除卡片) + Future _replyAddICCardBegin(Reply reply) async { + int status = reply.data[2]; + + switch(status){ + case 0x00: + //成功 + Get.log("${reply.commandType!.typeValue} 数据解析成功"); + cancelBlueConnetctToastTimer(); + dismissEasyLoading(); + editICCardData(); + break; + case 0x06: + //无权限 + Get.log("${reply.commandType!.typeValue} 需要鉴权"); + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var signKey = await Storage.getStringList(saveBlueSignKey); + List signKeyDataList = changeStringListToIntList(signKey!); + + var token = reply.data.sublist(5, 9); + var saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + IoSenderManage.senderAddCardWithTimeCycleCoercionCommand( + keyID:state.fingerprintItemData.value.cardId!.toString(), + userID:await Storage.getUid(), + cardNo:int.parse(state.fingerprintItemData.value.cardNumber!), + useCountLimit:0xff , + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:0, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环 + startDate: state.fingerprintItemData.value.startDate!~/1000, + endDate: state.fingerprintItemData.value.endDate!~/1000, + startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()), + endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()), + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: token, + ); + break; + default: + //失败 + Get.log("${reply.commandType!.typeValue} 失败"); + break; + } + } + + // 添加指纹开始 + Future _replyAddFingerprintBegin(Reply reply) async { + int status = reply.data[2]; + switch(status){ + case 0x00: + //成功 + Get.log("${reply.commandType!.typeValue} 数据解析成功"); + state.sureBtnState.value = 0; + cancelBlueConnetctToastTimer(); + dismissEasyLoading(); + editFingerprintsData(); + break; + case 0x06: + //无权限 + Get.log("${reply.commandType!.typeValue} 需要鉴权"); + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var signKey = await Storage.getStringList(saveBlueSignKey); + List signKeyDataList = changeStringListToIntList(signKey!); + + var token = reply.data.sublist(5, 9); + var saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand( + keyID:state.fingerprintItemData.value.fingerprintId.toString(), + userID:await Storage.getUid(), + fingerNo:int.parse(state.fingerprintItemData.value.fingerprintNumber!), + useCountLimit:0xff, + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:0, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环 + startDate: state.fingerprintItemData.value.startDate!~/1000, + endDate: state.fingerprintItemData.value.endDate!~/1000, + startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()), + endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()), + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: token, + ); + break; + default: + //失败 + Get.log("${reply.commandType!.typeValue} 失败"); + break; + } + } + + // 删除指纹 + Future senderAddFingerprint() async { + if(state.sureBtnState.value == 1){ + return; + } + state.sureBtnState.value = 1; + + showEasyLoading(); + showBlueConnetctToastTimer(action: (){ + dismissEasyLoading(); + state.sureBtnState.value = 0; + }); + BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected){ + // var publicKey = await Storage.getStringList(saveBluePublicKey); + // List publicKeyDataList = changeStringListToIntList(publicKey!); + + var signKey = await Storage.getStringList(saveBlueSignKey); + List signKeyDataList = changeStringListToIntList(signKey!); + + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var token = await Storage.getStringList(saveBlueToken); + List getTokenList = changeStringListToIntList(token!); + + IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand( + keyID:state.fingerprintItemData.value.fingerprintId.toString(), + userID:await Storage.getUid(), + fingerNo:int.parse(state.fingerprintItemData.value.fingerprintNumber!), + useCountLimit:0xff, + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:0, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环 + startDate: state.fingerprintItemData.value.startDate!~/1000, + endDate: state.fingerprintItemData.value.endDate!~/1000, + startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()), + endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()), + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: getTokenList, + ); + } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { + dismissEasyLoading(); + cancelBlueConnetctToastTimer(); + state.sureBtnState.value = 0; + if(state.ifCurrentScreen.value == true){ + showBlueConnetctToast(); + } + } + }); + } + + // 添加卡片 + Future senderAddICCard() async { + if(state.sureBtnState.value == 1){ + return; + } + state.sureBtnState.value = 1; + + showEasyLoading(); + showBlueConnetctToastTimer(action: (){ + dismissEasyLoading(); + state.sureBtnState.value = 0; + }); + BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected){ + + var signKey = await Storage.getStringList(saveBlueSignKey); + List signKeyDataList = changeStringListToIntList(signKey!); + + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var token = await Storage.getStringList(saveBlueToken); + List getTokenList = changeStringListToIntList(token!); + + IoSenderManage.senderAddCardWithTimeCycleCoercionCommand( + keyID:state.fingerprintItemData.value.cardId!.toString(), + userID:await Storage.getUid(), + cardNo:int.parse(state.fingerprintItemData.value.cardNumber!), + useCountLimit:0xff , + isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫 + isRound:0, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环 + startDate: state.fingerprintItemData.value.startDate!~/1000, + endDate: state.fingerprintItemData.value.endDate!~/1000, + startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()), + endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()), + needAuthor:1, + signKey:signKeyDataList, + privateKey:getPrivateKeyList, + token: getTokenList, + ); + } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { + dismissEasyLoading(); + cancelBlueConnetctToastTimer(); + state.sureBtnState.value = 0; + if(state.ifCurrentScreen.value == true){ + showBlueConnetctToast(); + } + } + }); + } + // 修改指纹信息 void editFingerprintsData() async{ - var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1); - var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1); - if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) { - showToast("失效时间需大于生效时间".tr); - return; - } - - if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) { - showToast("生效时间需大于当前时间".tr); - return; - } var entity = await ApiRepository.to.editFingerprintsData( fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(), lockId: state.fingerprintItemData.value.lockId.toString(), weekDay: state.fingerprintItemData.value.weekDay!, - startDate: beginTimeTimestamp.toString(), - endDate: endTimeTimestamp.toString(), + startDate: DateTool().dateToTimestamp(state.beginTime.value, 1).toString(), + endDate: DateTool().dateToTimestamp(state.endTime.value, 1).toString(), isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1", fingerprintName: state.fingerprintItemData.value.fingerprintName!, changeType: "1", @@ -39,8 +370,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ showToast("修改成功".tr, something: (){ eventBus.fire(OtherTypeRefreshListEvent()); Get.back(result: { - "beginTimeTimestamp":beginTimeTimestamp.toString(), - "endTimeTimestamp":endTimeTimestamp.toString(), + "beginTimeTimestamp":DateTool().dateToTimestamp(state.beginTime.value, 1).toString(), + "endTimeTimestamp":DateTool().dateToTimestamp(state.endTime.value, 1).toString(), }); }); } @@ -48,24 +379,12 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ // 编辑iC卡 void editICCardData() async{ - var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1); - var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1); - if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) { - showToast("失效时间需大于生效时间".tr); - return; - } - - if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) { - showToast("生效时间需大于当前时间".tr); - return; - } - var entity = await ApiRepository.to.editICCardData( cardId: state.fingerprintItemData.value.cardId.toString(), lockId: state.fingerprintItemData.value.lockId.toString(), weekDay: state.fingerprintItemData.value.weekDay!, - startDate: beginTimeTimestamp.toString(), - endDate: endTimeTimestamp.toString(), + startDate: DateTool().dateToTimestamp(state.beginTime.value, 1).toString(), + endDate: DateTool().dateToTimestamp(state.endTime.value, 1).toString(), isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1", cardName: state.fingerprintItemData.value.cardName!, changeType: '1', @@ -76,11 +395,55 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ if(entity.errorCode!.codeIsSuccessful){ showToast("修改成功".tr, something: (){ Get.back(result: { - "beginTimeTimestamp":beginTimeTimestamp.toString(), - "endTimeTimestamp":endTimeTimestamp.toString(), + "beginTimeTimestamp":DateTool().dateToTimestamp(state.beginTime.value, 1).toString(), + "endTimeTimestamp":DateTool().dateToTimestamp(state.endTime.value, 1).toString(), }); eventBus.fire(OtherTypeRefreshListEvent()); }); } } + + // 修改人脸有效期 + void editFaceData() async { + var entity = await ApiRepository.to.updateFaceValidity( + lockId: state.fingerprintItemData.value.lockId!, + faceId: state.fingerprintItemData.value.faceId!, + startDate: DateTool().dateToTimestamp(state.beginTime.value, 1), + endDate: DateTool().dateToTimestamp(state.endTime.value, 1), + startTime: 0, + endTime: 0, + faceType: 2, + weekDay: state.fingerprintItemData.value.weekDay!, + faceName: state.fingerprintItemData.value.faceName!, + addType: "1", + isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? 2 : 1, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast("修改成功", something: () { + Get.back(result: "addScuess"); + }); + } + } + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + + _initReplySubscription(); + } + + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + + _replySubscription.cancel(); + } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart index 93318d40..ca6d5c47 100644 --- a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart +++ b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart @@ -1,11 +1,13 @@ import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/tools/pickers/pickers.dart'; import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/dateTool.dart'; import '../../../../tools/titleAppBar.dart'; @@ -20,8 +22,7 @@ class OtherTypeKeyChangeDatePage extends StatefulWidget { _OtherTypeKeyChangeDatePageState(); } -class _OtherTypeKeyChangeDatePageState - extends State { +class _OtherTypeKeyChangeDatePageState extends State with RouteAware { final logic = Get.put(OtherTypeKeyChangeDateLogic()); final state = Get.find().state; @@ -41,16 +42,29 @@ class _OtherTypeKeyChangeDatePageState style: TextStyle(color: Colors.white, fontSize: 24.sp), ), onPressed: () { + var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1); + var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1); + if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) { + logic.showToast("失效时间需大于生效时间".tr); + return; + } + + if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) { + logic.showToast("生效时间需大于当前时间".tr); + return; + } switch (state.pushType.value) { case 0: // 卡 - logic.editICCardData(); + logic.senderAddICCard(); break; case 1: // 指纹 - logic.editFingerprintsData(); + logic.senderAddFingerprint(); break; case 2: + // 人脸 + logic.senderAddFace(); break; default: break; @@ -94,4 +108,60 @@ class _OtherTypeKeyChangeDatePageState ], ); } + + @override + void didChangeDependencies() { + // TODO: implement didChangeDependencies + super.didChangeDependencies(); + + /// 路由订阅 + AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); + } + + @override + void dispose() { + // TODO: implement dispose + /// 取消路由订阅 + AppRouteObserver().routeObserver.unsubscribe(this); + super.dispose(); + } + + /// 从上级界面进入 当前界面即将出现 + @override + void didPush() { + super.didPush(); + print("lockSet===didPush"); + state.ifCurrentScreen.value = true; + } + + /// 返回上一个界面 当前界面即将消失 + @override + void didPop() { + super.didPop(); + print("lockSet===didPop"); + logic.cancelBlueConnetctToastTimer(); + if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); + state.ifCurrentScreen.value = false; + state.sureBtnState.value = 0; + } + + /// 从下级返回 当前界面即将出现 + @override + void didPopNext() { + super.didPopNext(); + print("lockSet===didPopNext"); + state.ifCurrentScreen.value = true; + } + + /// 进入下级界面 当前界面即将消失 + @override + void didPushNext() { + super.didPushNext(); + print("lockSet===didPushNext"); + logic.cancelBlueConnetctToastTimer(); + if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); + state.ifCurrentScreen.value = false; + state.sureBtnState.value = 0; + } + } diff --git a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart index 38c6e8c6..9b532f74 100644 --- a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart +++ b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart @@ -9,7 +9,9 @@ class OtherTypeKeyChangeDateState{ var beginTime = "".obs;// 开始时间 var endTime = "".obs;// 结束时间 - var pushType = 0.obs;// 0卡 1指纹 2遥控 + var pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸 + var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) OtherTypeKeyChangeDateState() { Map map = Get.arguments; @@ -22,10 +24,6 @@ class OtherTypeKeyChangeDateState{ } if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){ - // getStartDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00"; //生效时间 - // // state.selectEffectiveDate.value = getStartDate; - // state.itemData.value.startDate = DateTime.parse(getStartDate).millisecondsSinceEpoch; - beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); }else{ diff --git a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart index 9b28945f..f2ab7884 100644 --- a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart @@ -1,6 +1,5 @@ import 'dart:async'; -// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; import 'package:star_lock/blue/io_protocol/io_addFace.dart'; @@ -25,26 +24,12 @@ class FaceDetailLogic extends BaseGetXController { _replySubscription = EventBusManager().eventBus!.on().listen((reply) { // 添加人脸开始(此处用作删除人脸) - if ((reply is SenderAddFaceReply)) { + if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) { _replyAddFaceBegin(reply); } }); } - String getKeyTypeShowDateTime() { - String useDateStr = ''; - if (state.keyType.value == 1) { - useDateStr = "永久"; - } else if (state.keyType.value == 2) { - useDateStr = - "${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}"; - } else if (state.keyType.value == 4) { - useDateStr = - "${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}"; - } - return useDateStr; - } - // 添加人脸开始 Future _replyAddFaceBegin(Reply reply) async { int status = reply.data[2]; @@ -53,7 +38,7 @@ class FaceDetailLogic extends BaseGetXController { switch (status) { case 0x00: //成功 - print("${reply.commandType!.typeValue} 删除人脸数据解析成功"); + Get.log("${reply.commandType!.typeValue} 删除人脸数据解析成功"); state.sureBtnState.value = 0; cancelBlueConnetctToastTimer(); dismissEasyLoading(); @@ -61,16 +46,12 @@ class FaceDetailLogic extends BaseGetXController { break; case 0x06: //无权限 - print("${reply.commandType!.typeValue} 删除人脸需要鉴权"); var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); - // var publicKey = await Storage.getStringList(saveBluePublicKey); - // List publicKeyDataList = changeStringListToIntList(publicKey!); - var token = reply.data.sublist(5, 9); var saveStrList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, saveStrList); @@ -79,39 +60,27 @@ class FaceDetailLogic extends BaseGetXController { keyID:state.keyId.value.toString(), userID:await Storage.getUid(), faceNo:int.parse(state.typeNumber.value), - useCountLimit:0, - isForce:0, // 是否是胁迫 - isRound:0, // 是否是循环 - weekRound:0, // 周循环 - startDate: 0x11223344, - endDate: 0x11223344, - startTime:"0", - endTime:"0", + useCountLimit:state.isDeletFace.value == true ? 0 : 0xff, + isForce:state.isStressFace.value == true ? 1 : 0, // 是否是胁迫 + isRound:state.keyType.value == 4 ? 1: 0, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环 + startDate: int.parse(state.startDate.value)~/1000, + endDate: int.parse(state.endDate.value)~/1000, + startTime:DateTool().dateToHNString(state.startTime.value), + endTime:DateTool().dateToHNString(state.endTime.value), needAuthor:1, signKey:signKeyDataList, privateKey:getPrivateKeyList, token: token, ); - break; - case 0x07: - //无权限 - print("${reply.commandType!.typeValue} 用户无权限"); - - break; - case 0x09: - // 权限校验错误 - print("${reply.commandType!.typeValue} 权限校验错误"); - break; default: //失败 - print("${reply.commandType!.typeValue} 删除人脸失败"); - break; } } - // 删除人脸 + // 删除/修改人脸信息 Future senderAddFace() async { if (state.sureBtnState.value == 1) { return; @@ -126,9 +95,6 @@ class FaceDetailLogic extends BaseGetXController { BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { - // var publicKey = await Storage.getStringList(saveBluePublicKey); - // List publicKeyDataList = changeStringListToIntList(publicKey!); - var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -142,14 +108,14 @@ class FaceDetailLogic extends BaseGetXController { keyID:state.keyId.value.toString(), userID:await Storage.getUid(), faceNo:int.parse(state.typeNumber.value), - useCountLimit:0, - isForce:0, // 是否是胁迫 - isRound:0, // 是否是循环 - weekRound:0, // 周循环 - startDate: 0x11223344, - endDate: 0x11223344, - startTime:"0", - endTime:"0", + useCountLimit:state.isDeletFace.value == true ? 0 : 0xff, + isForce:state.isStressFace.value == true ? 1 : 0, // 是否是胁迫 + isRound:state.keyType.value == 4 ? 1: 0, // 是否是循环 + weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环 + startDate: int.parse(state.startDate.value)~/1000, + endDate: int.parse(state.endDate.value)~/1000, + startTime:DateTool().dateToHNString(state.startTime.value), + endTime:DateTool().dateToHNString(state.endTime.value), needAuthor:1, signKey:signKeyDataList, privateKey:getPrivateKeyList, @@ -196,12 +162,19 @@ class FaceDetailLogic extends BaseGetXController { } // 修改人脸有效期 - void updateFaceValidityData() async { + void editFaceData() async { var entity = await ApiRepository.to.updateFaceValidity( lockId: state.faceItemData.value.lockId!, faceId: state.faceItemData.value.faceId!, - startDate: int.parse(state.startTime.value), - endDate: int.parse(state.endTime.value), + startDate: int.parse(state.startDate.value), + endDate: int.parse(state.endDate.value), + startTime: int.parse(state.startTime.value), + endTime: int.parse(state.endTime.value), + faceType: state.keyType.value, + weekDay: state.weekDay.value, + faceName: state.changeNameController.text, + addType: "1", + isCoerced: state.isStressFace.value ? 2 : 1, ); if (entity.errorCode!.codeIsSuccessful) { showToast("修改成功", something: () { @@ -210,6 +183,19 @@ class FaceDetailLogic extends BaseGetXController { } } + String getKeyTypeShowDateTime() { + String useDateStr = ''; + if (state.keyType.value == 1) { + useDateStr = "永久"; + } else if (state.keyType.value == 2) { + useDateStr = + "${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}"; + } else if (state.keyType.value == 4) { + useDateStr = + "${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}"; + } + return useDateStr; + } @override void onReady() { // TODO: implement onReady diff --git a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart index 56dd7b55..4c026067 100644 --- a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart +++ b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -12,6 +13,7 @@ import '../../../../tools/commonItem.dart'; import '../../../../tools/dateTool.dart'; import '../../../../tools/showIosTipView.dart'; import '../../../../tools/showTFView.dart'; +import '../../../../tools/showTipView.dart'; import '../../../../tools/storage.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; @@ -50,7 +52,19 @@ class _FaceDetailPageState extends State with RouteAware { isHaveDirection: true, isHaveLine: true, action: () { - showCupertinoAlertDialog(context); + // showCupertinoAlertDialog(context); + ShowTipView().showTFViewAlertDialog( + state.changeNameController, + "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", + "", (){ + if(state.changeNameController.text.isEmpty){ + logic.showToast("请输入姓名".tr); + return; + } + Get.back(); + state.typeName.value = state.changeNameController.text; + logic.updateFaceNameData(); + }); })), Obx(() => Visibility( visible: (state.keyType.value == 4 || @@ -71,7 +85,7 @@ class _FaceDetailPageState extends State with RouteAware { var data = await Get.toNamed( Routers.otherTypeKeyChangeDatePage, arguments: { - "pushType": 0, + "pushType": 2, "fingerprintItemData": state.faceItemData.value, }); if (data != null) { @@ -91,12 +105,11 @@ class _FaceDetailPageState extends State with RouteAware { }); if (data != null) { setState(() { - print("state.starDate.value:${data["starDate"]} " - "state.endDate.value:${data["endDate"]} " - "state.starTime.value:${data["starTime"]} " - "state.endTime.value:${data["endTime"]} " - "state.weekDay.value:${data["weekDay"]}"); - + // print("state.starDate.value:${data["starDate"]} " + // "state.endDate.value:${data["endDate"]} " + // "state.starTime.value:${data["starTime"]} " + // "state.endTime.value:${data["endTime"]} " + // "state.weekDay.value:${data["weekDay"]}"); state.startDate.value = data["starDate"]; state.endDate.value = data["endDate"]; state.startTime.value = data["starTime"]; @@ -165,6 +178,13 @@ class _FaceDetailPageState extends State with RouteAware { .dateToYMDHNString(state.addTime.value.toString()), )), SizedBox(height: 10.h), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.stressCard!.tr, + rightTitle: "", + isTipsImg: false, + isHaveRightWidget: true, + rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isStressFace()))), + Container(height: 10.h), CommonItem( leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr, rightTitle: "", @@ -186,55 +206,30 @@ class _FaceDetailPageState extends State with RouteAware { left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), onClick: () { - showIosTipViewDialog(context); + ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async { + state.isDeletFace.value = true; + logic.senderAddFace(); + }); }), ], ), ); } - void showCupertinoAlertDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return ShowTFView( - title: - "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", - tipTitle: "", - controller: state.changeNameController, - sureClick: () { - if (state.changeNameController.text.isEmpty) { - logic.showToast("请输入姓名"); - return; - } - Get.back(); - state.typeName.value = state.changeNameController.text; - // logic.editFaceData(); - }, - cancelClick: () { - Get.back(); - }, - ); - }); - } - - void showIosTipViewDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return ShowIosTipView( - title: "提示", - tipTitle: "确定要删除吗?", - sureClick: () async { - Get.back(); - String? idStr = await Storage.getUid(); - logic.senderAddFace(); - }, - cancelClick: () { - Get.back(); - }, - ); + CupertinoSwitch _isStressFace() { + return CupertinoSwitch( + activeColor: CupertinoColors.activeBlue, + trackColor: CupertinoColors.systemGrey5, + thumbColor: CupertinoColors.white, + value: state.isStressFace.value, + onChanged: (value) { + setState(() { + state.isStressFace.value = value; + state.isDeletFace.value = false; + logic.senderAddFace(); }); + }, + ); } @override @@ -266,10 +261,8 @@ class _FaceDetailPageState extends State with RouteAware { @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -278,7 +271,6 @@ class _FaceDetailPageState extends State with RouteAware { @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -286,10 +278,8 @@ class _FaceDetailPageState extends State with RouteAware { @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_state.dart b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_state.dart index 7a47f81c..ad48d857 100644 --- a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_state.dart +++ b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_state.dart @@ -21,6 +21,8 @@ class FaceDetailState { var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用) + var isDeletFace = true.obs;// 是否删除卡 + var isStressFace = false.obs;// 是否胁迫 FaceDetailState() { Map map = Get.arguments; @@ -37,5 +39,6 @@ class FaceDetailState { adder.value = faceItemData.value.senderUsername!; addTime.value = faceItemData.value.createDate!; weekDay.value = faceItemData.value.cyclicConfig!; + isStressFace.value = faceItemData.value.isCoerced! == 2 ? true : false; } } diff --git a/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart b/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart index ea6531f3..82f18e01 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart @@ -170,9 +170,7 @@ class _AddFingerprintPageState extends State with RouteAware @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; } @@ -180,7 +178,6 @@ class _AddFingerprintPageState extends State with RouteAware @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -188,11 +185,8 @@ class _AddFingerprintPageState extends State with RouteAware @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); - - BlueManage().stopScan(); state.ifCurrentScreen.value = false; } diff --git a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart index df863f6f..6a5775bf 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart @@ -24,7 +24,7 @@ class FingerprintDetailLogic extends BaseGetXController{ late StreamSubscription _replySubscription; void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((reply) { - // 添加指纹开始(此处用作删除指纹) + // 添加指纹开始(此处用作修改或者删除指纹) if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) { _replyAddFingerprintBegin(reply); } @@ -132,19 +132,6 @@ class FingerprintDetailLogic extends BaseGetXController{ privateKey:getPrivateKeyList, token: getTokenList, ); - - // IoSenderManage.senderAddFingerprintCommand( - // keyID:state.keyId.value.toString(), - // userID:userID, - // fingerNo:int.parse(state.typeNumber.value), - // useCountLimit:0, - // startTime:int.parse(state.starDate.value), - // endTime:int.parse(state.endDate.value), - // needAuthor:1, - // signKey:signKeyDataList, - // privateKey:getPrivateKeyList, - // token: getTokenList, - // ); } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { dismissEasyLoading(); cancelBlueConnetctToastTimer(); diff --git a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart index 202c4a19..d60f3e00 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart @@ -52,7 +52,19 @@ class _FingerprintDetailPageState extends State with Rout isHaveDirection: true, isHaveLine: true, action: () { - showCupertinoAlertDialog(context); + ShowTipView().showTFViewAlertDialog( + state.changeNameController, + "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", + "", (){ + if(state.changeNameController.text.isEmpty){ + logic.showToast("请输入姓名".tr); + return; + } + Get.back(); + state.typeName.value = state.changeNameController.text; + logic.editFingerprintsData(); + }); + })), Obx(() => Visibility( visible: (state.keyType.value == 4 || state.keyType.value == 2 || state.keyType.value == 1) ? true : false, @@ -210,30 +222,6 @@ class _FingerprintDetailPageState extends State with Rout ); } - void showCupertinoAlertDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return ShowTFView( - title: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", - tipTitle: "", - controller: state.changeNameController, - sureClick: () { - if(state.changeNameController.text.isEmpty){ - logic.showToast("请输入姓名".tr); - return; - } - Get.back(); - state.typeName.value = state.changeNameController.text; - // 指纹 - logic.editFingerprintsData(); - }, - cancelClick: () { - Get.back(); - },); - }); - } - @override void didChangeDependencies() { // TODO: implement didChangeDependencies @@ -255,7 +243,6 @@ class _FingerprintDetailPageState extends State with Rout @override void didPush() { super.didPush(); - print("lockSet===didPush"); state.ifCurrentScreen.value = true; } @@ -263,10 +250,8 @@ class _FingerprintDetailPageState extends State with Rout @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -275,7 +260,6 @@ class _FingerprintDetailPageState extends State with Rout @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -286,7 +270,6 @@ class _FingerprintDetailPageState extends State with Rout print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_state.dart b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_state.dart index 972d3e18..211e68bc 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_state.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_state.dart @@ -41,8 +41,7 @@ class FingerprintDetailState{ keyType.value = fingerprintItemData.value.fingerprintType!; adder.value = fingerprintItemData.value.senderUsername!; addTime.value = fingerprintItemData.value.createDate!; - isStressFingerprint.value = - fingerprintItemData.value.isCoerced! == 2 ? true : false; + isStressFingerprint.value = fingerprintItemData.value.isCoerced! == 2 ? true : false; weekDay.value = fingerprintItemData.value.weekDay!; } } diff --git a/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart b/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart index daff5fd2..194b10b4 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart @@ -282,10 +282,8 @@ class _FingerprintListPageState extends State with RouteAwa @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; } @@ -293,7 +291,6 @@ class _FingerprintListPageState extends State with RouteAwa @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -301,10 +298,8 @@ class _FingerprintListPageState extends State with RouteAwa @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; } diff --git a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart index 52798347..c90a01cd 100644 --- a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart +++ b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart @@ -386,10 +386,8 @@ class _CardDetailPageState extends State with RouteAware { @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -398,7 +396,6 @@ class _CardDetailPageState extends State with RouteAware { @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -406,10 +403,8 @@ class _CardDetailPageState extends State with RouteAware { @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index f5c06470..117f11e0 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -422,7 +422,7 @@ class LockDetailLogic extends BaseGetXController { Future openDoorAction() async { showBlueConnetctToastTimer(action: () { state.openLockBtnState.value = 0; - BlueManage().stopScan(); + // BlueManage().stopScan(); eventBus.fire(RefreshLockDetailInfoDataEvent()); }); var privateKey = await Storage.getStringList(saveBluePrivateKey); diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index aae63d83..837aff2f 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1286,7 +1286,6 @@ class _LockDetailPageState extends State Get.log("LockDetailPage===didPop"); state.ifCurrentScreen.value = false; logic.cancelBlueConnetctToastTimer(); - BlueManage().stopScan(); BlueManage().disconnect(); state.openLockBtnState.value = 0; } @@ -1306,7 +1305,6 @@ class _LockDetailPageState extends State Get.log("LockDetailPage===didPushNext"); state.ifCurrentScreen.value = false; logic.cancelBlueConnetctToastTimer(); - BlueManage().stopScan(); state.openLockBtnState.value = 0; } } diff --git a/star_lock/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_page.dart b/star_lock/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_page.dart index d27b185c..3d03acac 100644 --- a/star_lock/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_page.dart @@ -219,7 +219,6 @@ class _AutomaticBlockingPageState extends State with Rout @override void didPush() { super.didPush(); - print("lockSet===didPush"); state.ifCurrentScreen.value = true; } @@ -227,10 +226,8 @@ class _AutomaticBlockingPageState extends State with Rout @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -239,7 +236,6 @@ class _AutomaticBlockingPageState extends State with Rout @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -247,10 +243,8 @@ class _AutomaticBlockingPageState extends State with Rout @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart index 2fbd1e3b..c7a83118 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart @@ -120,7 +120,6 @@ class _UploadElectricQuantityPageState extends State @override void didPush() { super.didPush(); - print("lockSet===didPush"); state.ifCurrentScreen.value = true; } @@ -131,7 +130,6 @@ class _UploadElectricQuantityPageState extends State print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); logic.dismissEasyLoading(); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -140,7 +138,6 @@ class _UploadElectricQuantityPageState extends State @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -148,10 +145,8 @@ class _UploadElectricQuantityPageState extends State @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_page.dart b/star_lock/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_page.dart index 0cac9e22..308f80b5 100644 --- a/star_lock/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_page.dart @@ -108,7 +108,6 @@ class _BurglarAlarmPageState extends State with RouteAware{ logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -128,7 +127,6 @@ class _BurglarAlarmPageState extends State with RouteAware{ logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart b/star_lock/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart index 784b3b5d..a2b97767 100644 --- a/star_lock/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart @@ -143,7 +143,6 @@ class _ConfiguringWifiPageState extends State with RouteAwa print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -163,7 +162,6 @@ class _ConfiguringWifiPageState extends State with RouteAwa print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index b350c55f..f029c0f4 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -783,7 +783,6 @@ class _LockSetPageState extends State with RouteAware { // !state.deletWaitScanCompleter!.isCompleted) { // state.deletWaitScanCompleter!.complete(); // } - // BlueManage().stopScan(); state.ifCurrentScreen.value = false; } diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_page.dart b/star_lock/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_page.dart index aecf53d5..e564fbdf 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_page.dart @@ -244,7 +244,6 @@ class _LockSoundSetPageState extends State with RouteAware { super.didPop(); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -262,7 +261,6 @@ class _LockSoundSetPageState extends State with RouteAware { super.didPushNext(); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart b/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart index 1086d712..3815a732 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart @@ -97,7 +97,6 @@ class _LockTimePageState extends State with RouteAware{ @override void didPush() { super.didPush(); - print("lockSet===didPush"); state.ifCurrentScreen.value = true; } @@ -105,10 +104,8 @@ class _LockTimePageState extends State with RouteAware{ @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -125,10 +122,8 @@ class _LockTimePageState extends State with RouteAware{ @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_page.dart b/star_lock/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_page.dart index 5d39c337..d6c133bf 100644 --- a/star_lock/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_page.dart @@ -366,7 +366,6 @@ class _NormallyOpenModePageState extends State with RouteA super.didPop(); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -384,7 +383,6 @@ class _NormallyOpenModePageState extends State with RouteA super.didPushNext(); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart b/star_lock/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart index 1791834b..27d7b443 100644 --- a/star_lock/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart @@ -115,7 +115,6 @@ class _RemoteUnlockingPageState extends State super.didPop(); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -134,7 +133,6 @@ class _RemoteUnlockingPageState extends State logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/lockSet/resetButton/resetButton_page.dart b/star_lock/lib/main/lockDetail/lockSet/resetButton/resetButton_page.dart index 4f377807..6b695337 100644 --- a/star_lock/lib/main/lockDetail/lockSet/resetButton/resetButton_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/resetButton/resetButton_page.dart @@ -115,7 +115,6 @@ class _ResetButtonPageState extends State with RouteAware { @override void didPush() { super.didPush(); - print("lockSet===didPush"); state.ifCurrentScreen.value = true; } @@ -126,7 +125,6 @@ class _ResetButtonPageState extends State with RouteAware { print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -135,7 +133,6 @@ class _ResetButtonPageState extends State with RouteAware { @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -143,10 +140,8 @@ class _ResetButtonPageState extends State with RouteAware { @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart index 77fd9bd0..ce0f0631 100644 --- a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart +++ b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart @@ -263,7 +263,6 @@ class _PalmDetailPageState extends State with RouteAware { @override void didPush() { super.didPush(); - print("lockSet===didPush"); state.ifCurrentScreen.value = true; } @@ -271,10 +270,8 @@ class _PalmDetailPageState extends State with RouteAware { @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -283,7 +280,6 @@ class _PalmDetailPageState extends State with RouteAware { @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -291,10 +287,8 @@ class _PalmDetailPageState extends State with RouteAware { @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index 0672d6c0..d029fdd3 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -646,7 +646,6 @@ class _PasswordKeyPerpetualPageState extends State wit @override void didPush() { super.didPush(); - print("lockSet===didPush"); state.ifCurrentScreen.value = true; } @@ -654,10 +653,8 @@ class _PasswordKeyPerpetualPageState extends State wit @override void didPop() { super.didPop(); - print("lockSet===didPop"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } @@ -666,7 +663,6 @@ class _PasswordKeyPerpetualPageState extends State wit @override void didPopNext() { super.didPopNext(); - print("lockSet===didPopNext"); state.ifCurrentScreen.value = true; } @@ -674,10 +670,8 @@ class _PasswordKeyPerpetualPageState extends State wit @override void didPushNext() { super.didPushNext(); - print("lockSet===didPushNext"); logic.cancelBlueConnetctToastTimer(); if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); - BlueManage().stopScan(); state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } diff --git a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index ce8302ab..09f14344 100644 --- a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -143,8 +143,8 @@ class NearbyLockLogic extends BaseGetXController { // 厂商名称 var vendor = reply.data.sublist(3, 23); var vendorStr = utf8String(vendor); - // state.lockInfo["vendor"] = vendorStr; - state.lockInfo["vendor"] = "XL"; + state.lockInfo["vendor"] = vendorStr; + // state.lockInfo["vendor"] = "XL"; Get.log("vendor:$vendor vendorStr:$vendorStr reply.data:${reply.data}"); // 锁设备类型 @@ -155,8 +155,8 @@ class NearbyLockLogic extends BaseGetXController { // 产品名称 var model = reply.data.sublist(24, 44); var modelStr = utf8String(model); - // state.lockInfo["model"] = modelStr; - state.lockInfo["model"] = "JL-BLE-01"; + state.lockInfo["model"] = modelStr; + // state.lockInfo["model"] = "JL-BLE-01"; // Get.log("model:$model modelStr:$modelStr modelStr:${modelStr.length}"); // 软件版本 diff --git a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart index edd1ec73..01c907b6 100644 --- a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart +++ b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart @@ -442,7 +442,6 @@ class SaveLockLogic extends BaseGetXController { void onClose() { // TODO: implement onClose _replySubscription.cancel(); - BlueManage().stopScan(); super.onClose(); } diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 0bcaf519..3158f738 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -1226,14 +1226,32 @@ class ApiProvider extends BaseProvider { // 更新人脸用户信息--有效期 Future updateFaceValidity( - int faceId, int lockId, int startDate, int endDate) => + int faceId, + int lockId, + int startDate, + int endDate, + int startTime, + int endTime, + int faceType, + List weekDay, + String faceName, + String addType, + int isCoerced + ) => post( updateFaceUserInfoURL.toUrl, jsonEncode({ - 'faceId': faceId, 'lockId': lockId, + 'faceId': faceId, 'startDate': startDate, - 'endDate': endDate + 'endDate': endDate, + 'startTime': startTime, + 'endTime': endTime, + 'faceType': faceType, + "weekDay":weekDay, + 'faceName': faceName, + 'addType': addType, + "isCoerced": isCoerced, })); // 删除人脸 diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index b6d3afa5..60ca82fb 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -1403,11 +1403,18 @@ class ApiRepository { // 更新人脸用户信息--有效期 Future updateFaceValidity( {required int faceId, - required int lockId, - required int startDate, - required int endDate}) async { + required int lockId, + required int startDate, + required int endDate, + required int startTime, + required int endTime, + required int faceType, + required List weekDay, + required String faceName, + required String addType, + required int isCoerced}) async { final res = await apiProvider.updateFaceValidity( - faceId, lockId, startDate, endDate); + faceId, lockId, startDate, endDate, startTime, endTime, faceType, weekDay, faceName, addType, isCoerced); return LoginEntity.fromJson(res.body); } diff --git a/star_lock/lib/talk/udp/udp_help.dart b/star_lock/lib/talk/udp/udp_help.dart index a964a9a2..4b6145cb 100644 --- a/star_lock/lib/talk/udp/udp_help.dart +++ b/star_lock/lib/talk/udp/udp_help.dart @@ -36,8 +36,7 @@ class UdpHelp { for (var element in itemList) { serversList.add(int.parse(element)); } - print( - 'Resolved google.com to address: ${addresses.first.address} serversList:$serversList'); + print('Resolved google.com to address: ${addresses.first.address} serversList:$serversList'); } } diff --git a/star_lock/lib/tools/showTipView.dart b/star_lock/lib/tools/showTipView.dart index e8b1059c..f38ba524 100644 --- a/star_lock/lib/tools/showTipView.dart +++ b/star_lock/lib/tools/showTipView.dart @@ -115,7 +115,6 @@ class ShowTipView { }, cancelClick: () { // 取消的时候停止扫描 - // BlueManage().stopScan(); Get.back(); }, );