Merge branch 'master' of gitee.com:starlock-cn/app-starlock
This commit is contained in:
commit
c47ed1da10
@ -101,7 +101,6 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||
super.didPop();
|
||||
print("lockSet===didPop");
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
}
|
||||
|
||||
@ -121,7 +120,6 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
|
||||
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> 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),
|
||||
|
||||
@ -51,7 +51,18 @@ class _CardDetailPageState extends State<CardDetailPage> 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<CardDetailPage> 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<CardDetailPage> 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<CardDetailPage> 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<CardDetailPage> with RouteAware {
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -290,10 +256,8 @@ class _CardDetailPageState extends State<CardDetailPage> 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;
|
||||
}
|
||||
|
||||
@ -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!;
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,10 +331,8 @@ class _CardListPageState extends State<CardListPage> 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<CardListPage> with RouteAware {
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -350,10 +347,8 @@ class _CardListPageState extends State<CardListPage> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().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<void> _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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> 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<void> 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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> 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<void> _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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> 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<void> _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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> 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<void> 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<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> 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<void> 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<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> 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();
|
||||
}
|
||||
}
|
||||
@ -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<OtherTypeKeyChangeDatePage> {
|
||||
class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage> with RouteAware {
|
||||
final logic = Get.put(OtherTypeKeyChangeDateLogic());
|
||||
final state = Get.find<OtherTypeKeyChangeDateLogic>().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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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{
|
||||
|
||||
@ -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<Reply>().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<void> _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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
// List<int> 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<void> 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<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> 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
|
||||
|
||||
@ -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<FaceDetailPage> 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<FaceDetailPage> 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<FaceDetailPage> 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<FaceDetailPage> 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<FaceDetailPage> 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<FaceDetailPage> 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<FaceDetailPage> with RouteAware {
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -286,10 +278,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> 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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,9 +170,7 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> 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<AddFingerprintPage> with RouteAware
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -188,11 +185,8 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> with RouteAware
|
||||
@override
|
||||
void didPushNext() {
|
||||
super.didPushNext();
|
||||
print("lockSet===didPushNext");
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
|
||||
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().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();
|
||||
|
||||
@ -52,7 +52,19 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> 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<FingerprintDetailPage> 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<FingerprintDetailPage> with Rout
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -263,10 +250,8 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> 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<FingerprintDetailPage> with Rout
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -286,7 +270,6 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
print("lockSet===didPushNext");
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
|
||||
@ -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!;
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,10 +282,8 @@ class _FingerprintListPageState extends State<FingerprintListPage> 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<FingerprintListPage> with RouteAwa
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -301,10 +298,8 @@ class _FingerprintListPageState extends State<FingerprintListPage> 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;
|
||||
}
|
||||
|
||||
|
||||
@ -386,10 +386,8 @@ class _CardDetailPageState extends State<CardDetailPage> 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<CardDetailPage> with RouteAware {
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -406,10 +403,8 @@ class _CardDetailPageState extends State<CardDetailPage> 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;
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
Future<void> openDoorAction() async {
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
state.openLockBtnState.value = 0;
|
||||
BlueManage().stopScan();
|
||||
// BlueManage().stopScan();
|
||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||
});
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
|
||||
@ -1286,7 +1286,6 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
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<LockDetailPage>
|
||||
Get.log("LockDetailPage===didPushNext");
|
||||
state.ifCurrentScreen.value = false;
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
BlueManage().stopScan();
|
||||
state.openLockBtnState.value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,7 +219,6 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -227,10 +226,8 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> 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<AutomaticBlockingPage> with Rout
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -247,10 +243,8 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> 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;
|
||||
}
|
||||
|
||||
@ -120,7 +120,6 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -131,7 +130,6 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
||||
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<UploadElectricQuantityPage>
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -148,10 +145,8 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
||||
@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;
|
||||
}
|
||||
|
||||
@ -108,7 +108,6 @@ class _BurglarAlarmPageState extends State<BurglarAlarmPage> 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<BurglarAlarmPage> with RouteAware{
|
||||
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
|
||||
@ -143,7 +143,6 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> 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<ConfiguringWifiPage> with RouteAwa
|
||||
print("lockSet===didPushNext");
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
|
||||
@ -783,7 +783,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
// !state.deletWaitScanCompleter!.isCompleted) {
|
||||
// state.deletWaitScanCompleter!.complete();
|
||||
// }
|
||||
// BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
}
|
||||
|
||||
|
||||
@ -244,7 +244,6 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> 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<LockSoundSetPage> with RouteAware {
|
||||
super.didPushNext();
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
|
||||
@ -97,7 +97,6 @@ class _LockTimePageState extends State<LockTimePage> with RouteAware{
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -105,10 +104,8 @@ class _LockTimePageState extends State<LockTimePage> 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<LockTimePage> 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;
|
||||
}
|
||||
|
||||
@ -366,7 +366,6 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> 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<NormallyOpenModePage> with RouteA
|
||||
super.didPushNext();
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
|
||||
@ -115,7 +115,6 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage>
|
||||
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<RemoteUnlockingPage>
|
||||
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
|
||||
@ -115,7 +115,6 @@ class _ResetButtonPageState extends State<ResetButtonPage> with RouteAware {
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -126,7 +125,6 @@ class _ResetButtonPageState extends State<ResetButtonPage> 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<ResetButtonPage> with RouteAware {
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -143,10 +140,8 @@ class _ResetButtonPageState extends State<ResetButtonPage> 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;
|
||||
}
|
||||
|
||||
@ -263,7 +263,6 @@ class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -271,10 +270,8 @@ class _PalmDetailPageState extends State<PalmDetailPage> 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<PalmDetailPage> with RouteAware {
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -291,10 +287,8 @@ class _PalmDetailPageState extends State<PalmDetailPage> 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;
|
||||
}
|
||||
|
||||
@ -646,7 +646,6 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -654,10 +653,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> 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<PasswordKeyPerpetualPage> wit
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -674,10 +670,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> 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;
|
||||
}
|
||||
|
||||
@ -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}");
|
||||
|
||||
// 软件版本
|
||||
|
||||
@ -442,7 +442,6 @@ class SaveLockLogic extends BaseGetXController {
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
_replySubscription.cancel();
|
||||
BlueManage().stopScan();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
|
||||
@ -1228,14 +1228,32 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 更新人脸用户信息--有效期
|
||||
Future<Response> 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,
|
||||
}));
|
||||
|
||||
// 删除人脸
|
||||
|
||||
@ -1388,11 +1388,18 @@ class ApiRepository {
|
||||
// 更新人脸用户信息--有效期
|
||||
Future<LoginEntity> 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);
|
||||
}
|
||||
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,6 @@ class ShowTipView {
|
||||
},
|
||||
cancelClick: () {
|
||||
// 取消的时候停止扫描
|
||||
// BlueManage().stopScan();
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user