fix提测问题:锁设置-开锁提醒无法设置

This commit is contained in:
Daisy 2024-06-01 14:10:01 +08:00
parent ba0b9c0fab
commit af155c80c5
3 changed files with 59 additions and 54 deletions

View File

@ -1,4 +1,3 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
@ -64,7 +63,8 @@ class LockSetLogic extends BaseGetXController {
// } // }
// //
if (reply is UpdataLockSetReply && (state.ifCurrentScreen.value == true)) { if (reply is UpdataLockSetReply &&
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockSetReply(reply); _replyUpdataLockSetReply(reply);
} }
}); });
@ -128,11 +128,13 @@ class LockSetLogic extends BaseGetXController {
// //
final List<String>? privateKey = final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? publicKey = final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey); await Storage.getStringList(saveBluePublicKey);
final List<int> publicKeyDataList = changeStringListToIntList(publicKey!); final List<int> publicKeyDataList =
changeStringListToIntList(publicKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
@ -217,16 +219,19 @@ class LockSetLogic extends BaseGetXController {
// //
Future<void> _replyUpdataLockSetReply(Reply reply) async { Future<void> _replyUpdataLockSetReply(Reply reply) async {
final int status = reply.data[2]; final int status = reply.data[2];
switch(status){ switch (status) {
case 0x00: case 0x00:
// //
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
_lockDataUpload(uploadType:1, recordType:0, records:reply.data.sublist(7, reply.data.length)); _lockDataUpload(
uploadType: 1,
recordType: 0,
records: reply.data.sublist(7, reply.data.length));
break; break;
case 0x06: case 0x06:
// //
final List<int> token = reply.data.sublist(3, 7); final List<int> token = reply.data.sublist(3, 7);
final List<String> saveStrList = changeIntListToStringList(token); final List<String> saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
@ -294,11 +299,13 @@ class LockSetLogic extends BaseGetXController {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey = final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? publicKey = final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey); await Storage.getStringList(saveBluePublicKey);
final List<int> publicKeyDataList = changeStringListToIntList(publicKey!); final List<int> publicKeyDataList =
changeStringListToIntList(publicKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
@ -358,14 +365,16 @@ class LockSetLogic extends BaseGetXController {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey = final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? publicKey = final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey); await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList = changeStringListToIntList(publicKey!); final List<int> getPublicKeyList =
changeStringListToIntList(publicKey!);
state.settingUpSupportFeatures = type; state.settingUpSupportFeatures = type;
@ -404,7 +413,8 @@ class LockSetLogic extends BaseGetXController {
// //
Future<LockSetInfoEntity> getLockSettingInfoData() async { Future<LockSetInfoEntity> getLockSettingInfoData() async {
final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData( final LockSetInfoEntity entity =
await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockId.toString(), lockId: state.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -425,6 +435,8 @@ class LockSetLogic extends BaseGetXController {
state.lockSettingInfo.value.bluetoothBroadcast!; state.lockSettingInfo.value.bluetoothBroadcast!;
state.isOpenExceptionWarnings.value = state.isOpenExceptionWarnings.value =
state.lockSettingInfo.value.bluetoothBroadcast!; state.lockSettingInfo.value.bluetoothBroadcast!;
state.isUnlockReminder.value =
state.lockSettingInfo.value.unlockReminder!;
} }
return entity; return entity;
} }
@ -432,7 +444,8 @@ class LockSetLogic extends BaseGetXController {
// //
Future<void> openCheckingInData( Future<void> openCheckingInData(
BlockSetCheckInCallback blockSetCheckInCallback) async { BlockSetCheckInCallback blockSetCheckInCallback) async {
final CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData( final CheckingInInfoDataEntity entity =
await ApiRepository.to.openCheckingInData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -459,15 +472,15 @@ class LockSetLogic extends BaseGetXController {
// //
Future<void> setLockPickingReminder() async { Future<void> setLockPickingReminder() async {
final LoginEntity entity = await ApiRepository.to.setLockPickingReminderData( final LoginEntity entity =
await ApiRepository.to.setLockPickingReminderData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
unlockReminder: state.isLockPickingReminder.value == 1 ? 0 : 1, unlockReminder: state.isUnlockReminder.value == 1 ? 0 : 1,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.isLockPickingReminder.value = state.isUnlockReminder.value =
(state.isLockPickingReminder.value == 1 ? 0 : 1); (state.isUnlockReminder.value == 1 ? 0 : 1);
state.lockSettingInfo.value.unlockReminderPush = state.lockSettingInfo.value.unlockReminder = state.isUnlockReminder.value;
state.isLockPickingReminder.value;
showToast('设置成功'.tr, something: () { showToast('设置成功'.tr, something: () {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
}); });
@ -519,7 +532,8 @@ class LockSetLogic extends BaseGetXController {
ShowTipView().showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, ShowTipView().showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr,
() { () {
// //
ShowTipView().showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword); ShowTipView().showTFViewAlertDialog(
state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
}); });
} else if (state.lockBasicInfo.value.keyRight == 1) { } else if (state.lockBasicInfo.value.keyRight == 1) {
// //
@ -597,7 +611,8 @@ class LockSetLogic extends BaseGetXController {
Future<void> getUpdataLockSet() async { Future<void> getUpdataLockSet() async {
// showBlueConnetctToastTimer(action: (){ // showBlueConnetctToastTimer(action: (){
// }); // });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
@ -614,7 +629,8 @@ class LockSetLogic extends BaseGetXController {
// //
Future<void> updataLockSet(List<int> token) async { Future<void> updataLockSet(List<int> token) async {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -626,26 +642,21 @@ class LockSetLogic extends BaseGetXController {
token: token, token: token,
needAuthor: 1, needAuthor: 1,
signKey: signKeyDataList, signKey: signKeyDataList,
privateKey: getPrivateKeyList privateKey: getPrivateKeyList);
);
} }
// //
Future<void> _lockDataUpload({ Future<void> _lockDataUpload(
required int uploadType, {required int uploadType,
required int recordType, required int recordType,
required List records required List records}) async {
}) async{
final LoginEntity entity = await ApiRepository.to.lockDataUpload( final LoginEntity entity = await ApiRepository.to.lockDataUpload(
lockId: CommonDataManage().currentKeyInfo.lockId!, lockId: CommonDataManage().currentKeyInfo.lockId!,
uploadType:uploadType, uploadType: uploadType,
recordType: recordType, recordType: recordType,
records:records, records: records,
isUnShowLoading: true isUnShowLoading: true);
); if (entity.errorCode!.codeIsSuccessful) {}
if(entity.errorCode!.codeIsSuccessful){
}
} }
@override @override
@ -659,7 +670,6 @@ class LockSetLogic extends BaseGetXController {
@override @override
void onClose() { void onClose() {
_replySubscription.cancel(); _replySubscription.cancel();
_passCurrentLockInformationEvent!.cancel(); _passCurrentLockInformationEvent!.cancel();
// _scanListDiscoveredDeviceSubscription.cancel(); // _scanListDiscoveredDeviceSubscription.cancel();

View File

@ -490,9 +490,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
Obx( Obx(
() => Visibility( () => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 && visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.unlockReminder == 1 state.lockFeature.value.unlockReminder == 1,
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr, leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "", rightTitle: "",
@ -661,11 +659,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isLockPickingReminder.value == 1 ? true : false, value: state.isUnlockReminder.value == 1,
onChanged: (value) { onChanged: (bool value) {
setState(() { logic.setLockPickingReminder();
logic.setLockPickingReminder();
});
}, },
); );
} }

View File

@ -1,4 +1,3 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -15,13 +14,13 @@ class LockSetState {
final lockId = 0.obs; final lockId = 0.obs;
var isOnlyOneData = false.obs; var isOnlyOneData = false.obs;
var isAttendance = 0.obs;// var isAttendance = 0.obs; //
var isOpenLockNeedOnline = 0.obs;// APP开锁时是否需联网 var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
var isLockPickingReminder = 0.obs;// var isUnlockReminder = 0.obs; //
var isOpenBlueBroadcast = 0.obs;// 广 var isOpenBlueBroadcast = 0.obs; // 广
var isOpenExceptionWarnings = 0.obs;// var isOpenExceptionWarnings = 0.obs; //
var isOpenStayWarn = 0.obs;// var isOpenStayWarn = 0.obs; //
var passwordTF = TextEditingController(); var passwordTF = TextEditingController();
@ -34,4 +33,4 @@ class LockSetState {
lockId.value = map["lockId"]; lockId.value = map["lockId"];
isOnlyOneData.value = map["isOnlyOneData"]; isOnlyOneData.value = map["isOnlyOneData"];
} }
} }