fix提测问题:锁设置-开锁提醒无法设置
This commit is contained in:
parent
ba0b9c0fab
commit
af155c80c5
@ -1,4 +1,3 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
@ -128,11 +128,13 @@ class LockSetLogic extends BaseGetXController {
|
||||
//无权限
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? publicKey =
|
||||
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<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -217,16 +219,19 @@ class LockSetLogic extends BaseGetXController {
|
||||
// 上传数据获取锁设置解析
|
||||
Future<void> _replyUpdataLockSetReply(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
//成功
|
||||
dismissEasyLoading();
|
||||
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;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
final List<int> token = reply.data.sublist(3, 7);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
@ -294,11 +299,13 @@ class LockSetLogic extends BaseGetXController {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? publicKey =
|
||||
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<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -358,14 +365,16 @@ class LockSetLogic extends BaseGetXController {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
final List<String>? privateKey =
|
||||
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<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
final List<String>? publicKey =
|
||||
await Storage.getStringList(saveBluePublicKey);
|
||||
final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||
final List<int> getPublicKeyList =
|
||||
changeStringListToIntList(publicKey!);
|
||||
|
||||
state.settingUpSupportFeatures = type;
|
||||
|
||||
@ -404,7 +413,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 获取锁设置信息
|
||||
Future<LockSetInfoEntity> getLockSettingInfoData() async {
|
||||
final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
|
||||
final LockSetInfoEntity entity =
|
||||
await ApiRepository.to.getLockSettingInfoData(
|
||||
lockId: state.lockId.toString(),
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
@ -425,6 +435,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
state.lockSettingInfo.value.bluetoothBroadcast!;
|
||||
state.isOpenExceptionWarnings.value =
|
||||
state.lockSettingInfo.value.bluetoothBroadcast!;
|
||||
state.isUnlockReminder.value =
|
||||
state.lockSettingInfo.value.unlockReminder!;
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
@ -432,7 +444,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
// 开启考勤获取是否有公司
|
||||
Future<void> openCheckingInData(
|
||||
BlockSetCheckInCallback blockSetCheckInCallback) async {
|
||||
final CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData(
|
||||
final CheckingInInfoDataEntity entity =
|
||||
await ApiRepository.to.openCheckingInData(
|
||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
@ -459,15 +472,15 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 设置是否打开开锁提醒
|
||||
Future<void> setLockPickingReminder() async {
|
||||
final LoginEntity entity = await ApiRepository.to.setLockPickingReminderData(
|
||||
final LoginEntity entity =
|
||||
await ApiRepository.to.setLockPickingReminderData(
|
||||
lockId: state.lockSetInfoData.value.lockId!,
|
||||
unlockReminder: state.isLockPickingReminder.value == 1 ? 0 : 1,
|
||||
unlockReminder: state.isUnlockReminder.value == 1 ? 0 : 1,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isLockPickingReminder.value =
|
||||
(state.isLockPickingReminder.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.unlockReminderPush =
|
||||
state.isLockPickingReminder.value;
|
||||
state.isUnlockReminder.value =
|
||||
(state.isUnlockReminder.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.unlockReminder = state.isUnlockReminder.value;
|
||||
showToast('设置成功'.tr, something: () {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
@ -519,7 +532,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
ShowTipView().showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr,
|
||||
() {
|
||||
// 删除锁
|
||||
ShowTipView().showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
|
||||
});
|
||||
} else if (state.lockBasicInfo.value.keyRight == 1) {
|
||||
// 授权管理员弹框提示
|
||||
@ -597,7 +611,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
Future<void> getUpdataLockSet() async {
|
||||
// showBlueConnetctToastTimer(action: (){
|
||||
// });
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState connectionState) async {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -614,7 +629,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 公共的上传锁设置
|
||||
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<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
@ -626,26 +642,21 @@ class LockSetLogic extends BaseGetXController {
|
||||
token: token,
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList
|
||||
);
|
||||
privateKey: getPrivateKeyList);
|
||||
}
|
||||
|
||||
// 锁数据上传服务器
|
||||
Future<void> _lockDataUpload({
|
||||
required int uploadType,
|
||||
required int recordType,
|
||||
required List records
|
||||
}) async{
|
||||
Future<void> _lockDataUpload(
|
||||
{required int uploadType,
|
||||
required int recordType,
|
||||
required List records}) async {
|
||||
final LoginEntity entity = await ApiRepository.to.lockDataUpload(
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId!,
|
||||
uploadType:uploadType,
|
||||
uploadType: uploadType,
|
||||
recordType: recordType,
|
||||
records:records,
|
||||
isUnShowLoading: true
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
|
||||
}
|
||||
records: records,
|
||||
isUnShowLoading: true);
|
||||
if (entity.errorCode!.codeIsSuccessful) {}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -659,7 +670,6 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
|
||||
_replySubscription.cancel();
|
||||
_passCurrentLockInformationEvent!.cancel();
|
||||
// _scanListDiscoveredDeviceSubscription.cancel();
|
||||
|
||||
@ -490,9 +490,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
Obx(
|
||||
() => Visibility(
|
||||
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
|
||||
state.lockFeature.value.unlockReminder == 1
|
||||
? true
|
||||
: false,
|
||||
state.lockFeature.value.unlockReminder == 1,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
|
||||
rightTitle: "",
|
||||
@ -661,11 +659,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isLockPickingReminder.value == 1 ? true : false,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
logic.setLockPickingReminder();
|
||||
});
|
||||
value: state.isUnlockReminder.value == 1,
|
||||
onChanged: (bool value) {
|
||||
logic.setLockPickingReminder();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@ -15,13 +14,13 @@ class LockSetState {
|
||||
final lockId = 0.obs;
|
||||
|
||||
var isOnlyOneData = false.obs;
|
||||
var isAttendance = 0.obs;// 是否开启考勤
|
||||
var isOpenLockNeedOnline = 0.obs;// APP开锁时是否需联网
|
||||
var isAttendance = 0.obs; // 是否开启考勤
|
||||
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
||||
|
||||
var isLockPickingReminder = 0.obs;// 是否开启开锁提醒
|
||||
var isOpenBlueBroadcast = 0.obs;// 是否开启蓝牙广播
|
||||
var isOpenExceptionWarnings = 0.obs;// 是否开启异常警告
|
||||
var isOpenStayWarn = 0.obs;// 是否开启逗留警告
|
||||
var isUnlockReminder = 0.obs; // 是否开启开锁提醒
|
||||
var isOpenBlueBroadcast = 0.obs; // 是否开启蓝牙广播
|
||||
var isOpenExceptionWarnings = 0.obs; // 是否开启异常警告
|
||||
var isOpenStayWarn = 0.obs; // 是否开启逗留警告
|
||||
|
||||
var passwordTF = TextEditingController();
|
||||
|
||||
@ -34,4 +33,4 @@ class LockSetState {
|
||||
lockId.value = map["lockId"];
|
||||
isOnlyOneData.value = map["isOnlyOneData"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user