diff --git a/star_lock/lib/blue/sender_data.dart b/star_lock/lib/blue/sender_data.dart index 34c28c53..40332a56 100644 --- a/star_lock/lib/blue/sender_data.dart +++ b/star_lock/lib/blue/sender_data.dart @@ -45,7 +45,7 @@ class CommandSenderManager { bool canSendControlCommand = false; //TODO:发送常规数据 - Future managerSendData ({required SenderProtocol command, CommandSendCallBack? callBack}) async { + Future managerSendData ({required SenderProtocol command, bool isBeforeAddUser = false, CommandSendCallBack? callBack}) async { if (callBack != null) { // if (!BluetoothManager().connected) { print('❌ 蓝牙断开了'); @@ -57,8 +57,11 @@ class CommandSenderManager { return; } - List value = command.packageData(); - // print("CommonDataManage().currentLockUserNo:${CommonDataManage().currentLockUserNo}"); + List value = command.packageData(); + // print("command.commandTyp:${command.commandType}"); + if(isBeforeAddUser == true){ + _sendNormalData(value); + }else{ if(CommonDataManage().currentLockUserNo == 0){ // 先添加用户 var entity = await SenderBeforeDataManage().getAddUserKeyData(); @@ -69,6 +72,7 @@ class CommandSenderManager { // print("继续发送数据了继续发送数据了继续发送数据了"); _sendNormalData(value); } + } } void _sendNormalData(List data) async { diff --git a/star_lock/lib/blue/sender_manage.dart b/star_lock/lib/blue/sender_manage.dart index 9f1ee9f5..c1be31c9 100644 --- a/star_lock/lib/blue/sender_manage.dart +++ b/star_lock/lib/blue/sender_manage.dart @@ -44,6 +44,7 @@ class IoSenderManage { command: GetPublicKeyCommand( lockID: lockId, ), + isBeforeAddUser: true, callBack: callBack); } @@ -65,6 +66,7 @@ class IoSenderManage { publicKeyData: publicKeyData, needAuthor: needAuthor, ), + isBeforeAddUser: true, callBack: callBack); } @@ -101,6 +103,7 @@ class IoSenderManage { publicKey: publicKey, privateKey: privateKey, token: token), + isBeforeAddUser: true, callBack: callBack); } @@ -280,6 +283,7 @@ class IoSenderManage { required int? startTime, required int? endTime, required int? needAuthor, + required bool? isBeforeAddUser, required List? signKey, required List? privateKey, CommandSendCallBack? callBack}) { @@ -297,6 +301,7 @@ class IoSenderManage { signKey: signKey, privateKey: privateKey, ), + isBeforeAddUser: isBeforeAddUser ?? false, callBack: callBack); } @@ -311,6 +316,7 @@ class IoSenderManage { required int? startTime, required int? endTime, required int? needAuthor, + required bool? isBeforeAddUser, required List? signKey, required List? privateKey, CommandSendCallBack? callBack}) { @@ -328,6 +334,7 @@ class IoSenderManage { signKey: signKey, privateKey: privateKey, ), + isBeforeAddUser: isBeforeAddUser ?? false, callBack: callBack); } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index c932722d..6fceab32 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -50,6 +50,8 @@ class _LockDetailPageState extends State // TODO: implement initState super.initState(); + print("openDoor:${DateTool().accordingTheCycleIntoTheCorrespondingNumber([5])}"); + print("onLine:${DateTool().accordingTheCycleIntoTheCorrespondingNumber([1])}"); // logic.startScanAction(); listeningAnimations(); diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart index 5f10b31c..fdbdcd42 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart @@ -72,6 +72,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{ startTime: 0x11223344, endTime: 0x11223344, needAuthor: 1, + isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: token); @@ -230,6 +231,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{ startTime: 0x11223344, endTime: 0x11223344, needAuthor: 1, + isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList); diff --git a/star_lock/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart b/star_lock/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart index 69eb2bac..a262f371 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart @@ -14,13 +14,9 @@ import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart'; import 'package:star_lock/blue/io_reply.dart'; import 'package:star_lock/blue/io_tool/io_tool.dart'; import 'package:star_lock/blue/io_tool/manager_event_bus.dart'; -import 'package:star_lock/blue/sender_manage.dart'; -import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSet_logic.dart'; import 'package:star_lock/permission/permission_dialog.dart'; -import 'package:star_lock/tools/advancedCalendar/src/datetime_util.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/commonDataManage.dart'; -import 'package:star_lock/tools/pickers/time_picker/time_utils.dart'; import 'package:star_lock/tools/storage.dart'; import 'lockEscalation_state.dart'; diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart index 8b4d018d..097129cd 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart @@ -55,6 +55,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { startTime:0x11223344, endTime:0x11223344, needAuthor: 1, + isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: token); @@ -138,6 +139,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { startTime:0x11223344, endTime:0x11223344, needAuthor: 1, + isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index 46056c84..0dc5f0fa 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -74,6 +74,7 @@ class PasswordKeyListLogic extends BaseGetXController { startTime:0x11223344, endTime:0x11223344, needAuthor: 1, + isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: token); @@ -162,6 +163,7 @@ class PasswordKeyListLogic extends BaseGetXController { startTime:0x11223344, endTime:0x11223344, needAuthor: 1, + isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index 80294890..d97c0fb9 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -253,6 +253,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000, endTime: DateTool().dateToTimestamp(state.endTime.value, 1)~/1000, needAuthor: 1, + isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: token); @@ -335,6 +336,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { startTime:state.isPermanent.value == false ? startDate ~/ 1000 : 0, endTime: state.isPermanent.value == false ? endDate ~/ 1000 : 0, needAuthor: 1, + isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList); @@ -394,6 +396,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { return "您好,您的密码是:${state.getPwdStr.value}\n$useDateStr\n密码名字:${state.pwdNameStr}"; } + String addSpaces(String input) { + return input.replaceAllMapped(RegExp(r'.{4}'), (match) { + return '${match.group(0)} '; + }).trim(); + } + @override void onReady() { // TODO: implement onReady 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 3f10ff8e..315f384b 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 @@ -412,7 +412,7 @@ class _PasswordKeyPerpetualPageState extends State wit height: 10.h, ), Text( - state.getPwdStr.value, + logic.addSpaces(state.getPwdStr.value), style: TextStyle( fontSize: 40.sp, color: Colors.black, diff --git a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart index 9d74d812..7313befe 100644 --- a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart +++ b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart @@ -140,6 +140,7 @@ class SaveLockLogic extends BaseGetXController { startTime: 0x11223344, endTime: 0x11223344, needAuthor: 1, + isBeforeAddUser: true, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: token); @@ -184,6 +185,7 @@ class SaveLockLogic extends BaseGetXController { startTime: 0x11223344, endTime: 0x11223344, needAuthor: 1, + isBeforeAddUser: true, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: token); @@ -271,6 +273,7 @@ class SaveLockLogic extends BaseGetXController { startTime: 0x11223344, endTime: 0x11223344, needAuthor: 1, + isBeforeAddUser: true, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList); @@ -304,6 +307,7 @@ class SaveLockLogic extends BaseGetXController { startTime: 0x11223344, endTime: 0x11223344, needAuthor: 1, + isBeforeAddUser: true, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList);