fix:密码分享到微信的纯文本内容修改
This commit is contained in:
parent
88af212844
commit
53694a0621
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
@ -22,68 +21,77 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
_replySubscription =
|
||||||
// 设置自定义密码
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
if (reply is SenderCustomPasswordsReply && state.ifCurrentScreen.value == true) {
|
// 设置自定义密码
|
||||||
final int status = reply.data[2];
|
if (reply is SenderCustomPasswordsReply &&
|
||||||
switch (status) {
|
state.ifCurrentScreen.value == true) {
|
||||||
case 0x00:
|
final int status = reply.data[2];
|
||||||
//成功
|
switch (status) {
|
||||||
state.sureBtnState.value = 0;
|
case 0x00:
|
||||||
dismissEasyLoading();
|
//成功
|
||||||
cancelBlueConnetctToastTimer();
|
state.sureBtnState.value = 0;
|
||||||
if(state.isDeletPasswordKey.value == true){
|
dismissEasyLoading();
|
||||||
deletePwdRequest();
|
cancelBlueConnetctToastTimer();
|
||||||
}else{
|
if (state.isDeletPasswordKey.value == true) {
|
||||||
updatePwdRequest(2);
|
deletePwdRequest();
|
||||||
}
|
} else {
|
||||||
break;
|
updatePwdRequest(2);
|
||||||
case 0x06:
|
|
||||||
//无权限
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
|
||||||
final List<String> saveStrList = changeIntListToStringList(token);
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
IoSenderManage.senderCustomPasswordsCommand(
|
|
||||||
keyID:state.itemData.value.keyboardPwdId!.toString(),
|
|
||||||
userID:await Storage.getUid(),
|
|
||||||
pwdNo: state.itemData.value.pwdUserNo!,
|
|
||||||
pwd: state.inputPwdController.text,
|
|
||||||
useCountLimit: 0xffff,
|
|
||||||
operate: state.itemData.value.isCustom == 1 ? (state.isDeletPasswordKey.value == true ? 2 : 1) : 3,
|
|
||||||
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
|
||||||
startTime:state.itemData.value.startDate! ~/ 1000,
|
|
||||||
endTime:state.itemData.value.endDate! ~/ 1000,
|
|
||||||
needAuthor: 1,
|
|
||||||
isBeforeAddUser: false,
|
|
||||||
signKey: signKeyDataList,
|
|
||||||
privateKey: getPrivateKeyList,
|
|
||||||
token: token);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//失败
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
});
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey =
|
||||||
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList =
|
||||||
|
changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
|
keyID: state.itemData.value.keyboardPwdId!.toString(),
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
pwdNo: state.itemData.value.pwdUserNo!,
|
||||||
|
pwd: state.inputPwdController.text,
|
||||||
|
useCountLimit: 0xffff,
|
||||||
|
operate: state.itemData.value.isCustom == 1
|
||||||
|
? (state.isDeletPasswordKey.value == true ? 2 : 1)
|
||||||
|
: 3,
|
||||||
|
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||||
|
startTime: state.itemData.value.startDate! ~/ 1000,
|
||||||
|
endTime: state.itemData.value.endDate! ~/ 1000,
|
||||||
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: false,
|
||||||
|
signKey: signKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: token);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除密码请求 deleteType:1-蓝牙 2-网关
|
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||||
Future<void> deletePwdRequest() async {
|
Future<void> deletePwdRequest() async {
|
||||||
final PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
final PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
||||||
lockId:state.itemData.value.lockId.toString(),
|
lockId: state.itemData.value.lockId.toString(),
|
||||||
keyboardPwdId:state.itemData.value.keyboardPwdId.toString(),
|
keyboardPwdId: state.itemData.value.keyboardPwdId.toString(),
|
||||||
deleteType:1);
|
deleteType: 1);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast('删除成功'.tr, something: (){
|
showToast('删除成功'.tr, something: () {
|
||||||
// eventBus.fire(GetPasswordListRefreshUI());
|
// eventBus.fire(GetPasswordListRefreshUI());
|
||||||
Get.back(result: 'deletScuess');
|
Get.back(result: 'deletScuess');
|
||||||
});
|
});
|
||||||
@ -107,12 +115,12 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
pwdRight: state.isAdministrator.value == true ? 1 : 0);
|
pwdRight: state.isAdministrator.value == true ? 1 : 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
Get.back();
|
Get.back();
|
||||||
showToast('修改成功'.tr, something: (){
|
showToast('修改成功'.tr, something: () {
|
||||||
if(changType == 1){
|
if (changType == 1) {
|
||||||
// 修改名字
|
// 修改名字
|
||||||
state.keyboardPwdName.value = state.inputNameController.text;
|
state.keyboardPwdName.value = state.inputNameController.text;
|
||||||
state.itemData.value.keyboardPwdName = state.keyboardPwdName.value;
|
state.itemData.value.keyboardPwdName = state.keyboardPwdName.value;
|
||||||
}else if(changType == 2){
|
} else if (changType == 2) {
|
||||||
// 修改密码
|
// 修改密码
|
||||||
state.keyboardPwd.value = state.inputPwdController.text;
|
state.keyboardPwd.value = state.inputPwdController.text;
|
||||||
state.itemData.value.keyboardPwd = state.keyboardPwd.value;
|
state.itemData.value.keyboardPwd = state.keyboardPwd.value;
|
||||||
@ -124,43 +132,49 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 设置自定义密码 这里用作修改或者删除密码
|
// 设置自定义密码 这里用作修改或者删除密码
|
||||||
Future<void> senderCustomPasswords() async {
|
Future<void> senderCustomPasswords() async {
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
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!);
|
||||||
|
|
||||||
IoSenderManage.senderCustomPasswordsCommand(
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
keyID:state.itemData.value.keyboardPwdId!.toString(),
|
keyID: state.itemData.value.keyboardPwdId!.toString(),
|
||||||
userID:await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
pwdNo: state.itemData.value.pwdUserNo!,
|
pwdNo: state.itemData.value.pwdUserNo!,
|
||||||
pwd: state.inputPwdController.text,
|
pwd: state.inputPwdController.text,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
operate: state.itemData.value.isCustom == 1 ? (state.isDeletPasswordKey.value == true ? 2 : 1) : 3,
|
operate: state.itemData.value.isCustom == 1
|
||||||
|
? (state.isDeletPasswordKey.value == true ? 2 : 1)
|
||||||
|
: 3,
|
||||||
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||||
startTime:state.itemData.value.startDate! ~/ 1000,
|
startTime: state.itemData.value.startDate! ~/ 1000,
|
||||||
endTime:state.itemData.value.endDate! ~/ 1000,
|
endTime: state.itemData.value.endDate! ~/ 1000,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,162 +185,359 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
String getUseDateStr() {
|
String getUseDateStr() {
|
||||||
final int? getPwdType = state.itemData.value.keyboardPwdType;
|
final int? getPwdType = state.itemData.value.keyboardPwdType;
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
final DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
final DateTime startDateStr =
|
||||||
final DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||||
|
final DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||||
final String starHour = '${state.itemData.value.hoursStart}';
|
final String starHour = '${state.itemData.value.hoursStart}';
|
||||||
final String endHour = '${state.itemData.value.hoursEnd}';
|
final String endHour = '${state.itemData.value.hoursEnd}';
|
||||||
|
|
||||||
switch (getPwdType) {
|
switch (getPwdType) {
|
||||||
case 1:
|
case 1:
|
||||||
//单次 1 只能在开始时间后6小时内使用一次
|
//单次 1 只能在开始时间后6小时内使用一次
|
||||||
useDateStr =
|
useDateStr = '\n' +
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
'类型'.tr +
|
||||||
state.isCirculation.value = false;
|
':' +
|
||||||
|
'单次'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'有效期'.tr +
|
||||||
|
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
||||||
|
'这是单次密码,只能使用一次\n';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr = '永久';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = false;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'永久'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n注:\n' +
|
||||||
|
'必需在开始时间24小时内使用一次,否则将失效\n';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr =
|
useDateStr = '\n' +
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!-1).toLocal().toString().substring(0, 16)}';
|
'类型'.tr +
|
||||||
state.isCirculation.value = false;
|
':' +
|
||||||
|
'限时'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'有效期'.tr +
|
||||||
|
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
||||||
|
'\n' +
|
||||||
|
'\n注:\n' +
|
||||||
|
'必需在开始时间24小时内使用一次,否则将失效\n';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
useDateStr =
|
useDateStr = '类型'.tr + ':' + '清空'.tr;
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
|
||||||
state.isCirculation.value = false;
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
useDateStr = '周末'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周末'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||||
useDateStr = '每日'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'每日'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||||
useDateStr = '工作日'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'工作日'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||||
useDateStr = '周一'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周一'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||||
useDateStr = '周二'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周二'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||||
useDateStr = '周三'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周三'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||||
useDateStr = '周四'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周四'.tr +
|
||||||
|
' $starHour:00 -$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||||
useDateStr = '周五'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周五'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||||
useDateStr = '周六'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周六'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
//周日循环 14 每周日开始和结束时间指定时间段内有效
|
//周日循环 14 每周日开始和结束时间指定时间段内有效
|
||||||
useDateStr = '周日'.tr + '$starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
state.isCirculation.value = true;
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周日'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return useDateStr;
|
// return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
||||||
|
return '您好' +
|
||||||
|
',\n您的开门密码是' +
|
||||||
|
':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}\n\n开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标';
|
||||||
}
|
}
|
||||||
|
|
||||||
String getShareContentStr() {
|
String getShareContentStr() {
|
||||||
final int? getPwdType = state.itemData.value.keyboardPwdType;
|
final int? getPwdType = state.itemData.value.keyboardPwdType;
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
final DateTime startDateStr =
|
final DateTime startDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||||
final DateTime endDateStr =
|
final DateTime endDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||||
final int starHour = startDateStr.hour;
|
final int starHour = startDateStr.hour;
|
||||||
final int endHour = endDateStr.hour;
|
final int endHour = endDateStr.hour;
|
||||||
|
|
||||||
switch (getPwdType) {
|
switch (getPwdType) {
|
||||||
case 1:
|
case 1:
|
||||||
//单次 1 只能在开始时间后6小时内使用一次
|
//单次 1 只能在开始时间后6小时内使用一次
|
||||||
useDateStr =
|
useDateStr = '\n' +
|
||||||
'类型'.tr + ':' + '永久'.tr + '\n' + '有效期'.tr + ':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}';
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'单次'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'有效期'.tr +
|
||||||
|
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
||||||
|
'这是单次密码,只能使用一次\n';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr = '类型'.tr + ':' + '永久'.tr;
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'永久'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n注:\n' +
|
||||||
|
'必需在开始时间24小时内使用一次,否则将失效\n';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr =
|
useDateStr = '\n' +
|
||||||
'类型'.tr + ':' + '限时'.tr + '\n' + '有效期'.tr + ':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'限时'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'有效期'.tr +
|
||||||
|
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
||||||
|
'\n' +
|
||||||
|
'\n注:\n' +
|
||||||
|
'必需在开始时间24小时内使用一次,否则将失效\n';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
useDateStr = '类型'.tr + ':' + '清空'.tr;
|
useDateStr = '类型'.tr + ':' + '清空'.tr;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '周末'.tr + ' $starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周末'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '每日'.tr + ' $starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'每日'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '工作日'.tr + ' $starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'工作日'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '周一'.tr + ' $starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周一'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '周二'.tr + ' $starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周二'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '周三'.tr + ' $starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周三'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '周四'.tr + ' $starHour:00 -$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周四'.tr +
|
||||||
|
' $starHour:00 -$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '周五'.tr + ' $starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周五'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '周六'.tr + ' $starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周六'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
//周日循环 14 每周日开始和结束时间指定时间段内有效
|
//周日循环 14 每周日开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型'.tr + ':' + '循环'.tr + '\n' + '周日'.tr + ' $starHour:00-$endHour:00';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周日'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
// return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
||||||
|
return '您好' +
|
||||||
|
',\n您的开门密码是' +
|
||||||
|
':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}\n\n开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -341,5 +552,4 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
void onClose() {
|
void onClose() {
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,10 +183,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
final String getMobile = (await Storage.getMobile())!;
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name':BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
'account':
|
||||||
'date':DateTool().getNowDateWithType(1),
|
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
'add_password_result':'成功',
|
'date': DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result': '成功',
|
||||||
});
|
});
|
||||||
|
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
@ -200,10 +201,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name':BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
'account':
|
||||||
'date':DateTool().getNowDateWithType(1),
|
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
'add_password_result':'${entity.errorMsg}',
|
'date': DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result': '${entity.errorMsg}',
|
||||||
});
|
});
|
||||||
showToast('${entity.errorMsg}');
|
showToast('${entity.errorMsg}');
|
||||||
}
|
}
|
||||||
@ -244,15 +246,16 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
// 设置自定义密码
|
// 设置自定义密码
|
||||||
if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderCustomPasswordsReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
BuglyTool.uploadException(
|
BuglyTool.uploadException(
|
||||||
message: '添加密码结果,解析数据',
|
message: '添加密码结果,解析数据',
|
||||||
detail: '添加密码结果,解析数据:${reply.data}',
|
detail: '添加密码结果,解析数据:${reply.data}',
|
||||||
eventStr: '添加密码事件结果',
|
eventStr: '添加密码事件结果',
|
||||||
upload: true
|
upload: true);
|
||||||
);
|
|
||||||
|
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -393,45 +396,45 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
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>? 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 String command = SenderCustomPasswordsCommand(
|
final String command = SenderCustomPasswordsCommand(
|
||||||
keyID: '1',
|
keyID: '1',
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
pwdNo: 0,
|
pwdNo: 0,
|
||||||
pwd: state.pwdController.text,
|
pwd: state.pwdController.text,
|
||||||
operate: 0,
|
operate: 0,
|
||||||
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
startTime: startDate ~/ 1000,
|
startTime: startDate ~/ 1000,
|
||||||
endTime: endDate ~/ 1000,
|
endTime: endDate ~/ 1000,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList
|
token: getTokenList)
|
||||||
).toString();
|
.toString();
|
||||||
|
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: () async {
|
showBlueConnetctToastTimer(action: () async {
|
||||||
final String getMobile = (await Storage.getMobile())!;
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name':BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
'account':
|
||||||
'date':DateTool().getNowDateWithType(1),
|
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
'add_password_result':'添加自定义密码超时',
|
'date': DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result': '添加自定义密码超时',
|
||||||
});
|
});
|
||||||
|
|
||||||
BuglyTool.uploadException(
|
BuglyTool.uploadException(
|
||||||
message: '添加密码超时处理-添加密码失败',
|
message: '添加密码超时处理-添加密码失败',
|
||||||
detail: '添加密码超时,添加密码失败--senderCustomPasswordsCommand:$command',
|
detail: '添加密码超时,添加密码失败--senderCustomPasswordsCommand:$command',
|
||||||
eventStr: '添加密码事件超时',
|
eventStr: '添加密码事件超时',
|
||||||
upload: true
|
upload: true);
|
||||||
);
|
|
||||||
|
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
@ -439,11 +442,14 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
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!);
|
||||||
@ -463,21 +469,22 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
final String getMobile = (await Storage.getMobile())!;
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name':BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
'account':
|
||||||
'date':DateTool().getNowDateWithType(1),
|
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
'add_password_result':'添加自定义密码断开',
|
'date': DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result': '添加自定义密码断开',
|
||||||
});
|
});
|
||||||
|
|
||||||
BuglyTool.uploadException(
|
BuglyTool.uploadException(
|
||||||
message: '添加密码断开-添加密码失败',
|
message: '添加密码断开-添加密码失败',
|
||||||
detail: '添加密码断开,添加密码失败--senderCustomPasswordsCommand:$command',
|
detail: '添加密码断开,添加密码失败--senderCustomPasswordsCommand:$command',
|
||||||
eventStr: '添加密码事件断开连接',
|
eventStr: '添加密码事件断开连接',
|
||||||
upload: true
|
upload: true);
|
||||||
);
|
|
||||||
|
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -492,27 +499,49 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
String getShareContentStr() {
|
String getShareContentStr() {
|
||||||
final int getPwdType = state.widgetType.value;
|
final int getPwdType = state.widgetType.value;
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
// DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
|
||||||
// DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
DateTime startDateStr = DateTime.parse(state.beginTime.value)!;
|
||||||
// int starHour = startDateStr.hour;
|
DateTime endDateStr = DateTime.parse(state.endTime.value)!;
|
||||||
// int endHour = endDateStr.hour;
|
|
||||||
|
int starHour = startDateStr.hour;
|
||||||
|
int endHour = endDateStr.hour;
|
||||||
|
|
||||||
switch (getPwdType) {
|
switch (getPwdType) {
|
||||||
|
case 2:
|
||||||
|
//单次 1 只能在开始时间后6小时内使用一次
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'单次'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'有效期'.tr +
|
||||||
|
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
||||||
|
'这是单次密码,只能使用一次\n';
|
||||||
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
// 永久 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr = '类型'.tr + ':' + '永久';
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'永久'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n注:\n' +
|
||||||
|
'必需在开始时间24小时内使用一次,否则将失效\n';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
//限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr = '类型'.tr +
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
':' +
|
':' +
|
||||||
'限时\n${'有效期'.tr}:${state.beginTime.value} -- ${state.endTime.value}';
|
'限时'.tr +
|
||||||
break;
|
'\n' +
|
||||||
case 2:
|
'\n' +
|
||||||
//单次 只能在开始时间后6小时内使用一次
|
'有效期'.tr +
|
||||||
useDateStr = '类型'.tr +
|
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
||||||
':' +
|
'\n' +
|
||||||
'单次\n${'有效期'.tr}:${state.beginTime.value} -- ${state.endTime.value}';
|
'\n注:\n' +
|
||||||
|
'必需在开始时间24小时内使用一次,否则将失效\n';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//自定义
|
//自定义
|
||||||
@ -524,20 +553,177 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
useDateStr = '类型:自定义-永久'.tr;
|
useDateStr = '类型:自定义-永久'.tr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
|
||||||
//周未循环 在周未开始和结束时间指定时间段内有效
|
|
||||||
useDateStr = '类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}';
|
|
||||||
break;
|
|
||||||
case 5:
|
case 5:
|
||||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
useDateStr = '类型:清空';
|
useDateStr = '类型'.tr + ':' + '清空'.tr;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周末'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'每日'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'工作日'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周一'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周二'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周三'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周四'.tr +
|
||||||
|
' $starHour:00 -$endHour:00' +
|
||||||
|
'\n';
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周五'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周六'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
//周日循环 14 每周日开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '\n' +
|
||||||
|
'类型'.tr +
|
||||||
|
':' +
|
||||||
|
'循环'.tr +
|
||||||
|
'\n' +
|
||||||
|
'\n' +
|
||||||
|
'周日'.tr +
|
||||||
|
' $starHour:00-$endHour:00' +
|
||||||
|
'\n';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return '${'您好,您的密码是'.tr}:${state.getPwdStr.value}\n$useDateStr\n${'密码名字'.tr}:${state.pwdNameStr}';
|
// return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
||||||
|
return '您好' +
|
||||||
|
',\n您的开门密码是' +
|
||||||
|
':${state.getPwdStr.value}\n$useDateStr\n${'密码名字'.tr}:${state.pwdNameStr}\n\n开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标';
|
||||||
|
// switch (getPwdType) {
|
||||||
|
// case 0:
|
||||||
|
// // 永久 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
|
// useDateStr = '类型'.tr + ':' + '永久';
|
||||||
|
// break;
|
||||||
|
// case 1:
|
||||||
|
// //限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
|
// useDateStr = '类型'.tr +
|
||||||
|
// ':' +
|
||||||
|
// '限时\n${'有效期'.tr}:${state.beginTime.value} -- ${state.endTime.value}';
|
||||||
|
// break;
|
||||||
|
// case 2:
|
||||||
|
// //单次 只能在开始时间后6小时内使用一次
|
||||||
|
// useDateStr = '类型'.tr +
|
||||||
|
// ':' +
|
||||||
|
// '单次\n${'有效期'.tr}:${state.beginTime.value} -- ${state.endTime.value}';
|
||||||
|
// break;
|
||||||
|
// case 3:
|
||||||
|
// //自定义
|
||||||
|
// if (state.isPermanent.value == false) {
|
||||||
|
// useDateStr = '类型'.tr +
|
||||||
|
// ':' +
|
||||||
|
// '自定义-限时\n${'有效期'.tr}:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
||||||
|
// } else {
|
||||||
|
// useDateStr = '类型:自定义-永久'.tr;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// case 4:
|
||||||
|
// //周未循环 在周未开始和结束时间指定时间段内有效
|
||||||
|
// useDateStr = '类型'.tr +
|
||||||
|
// ':' +
|
||||||
|
// '循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}';
|
||||||
|
// break;
|
||||||
|
// case 5:
|
||||||
|
// //删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
|
// useDateStr = '类型:清空';
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// default:
|
||||||
|
// }
|
||||||
|
// return '${'您好,您的密码是'.tr}:${state.getPwdStr.value}\n$useDateStr\n${'密码名字'.tr}:${state.pwdNameStr}';
|
||||||
}
|
}
|
||||||
|
|
||||||
String addSpaces(String input) {
|
String addSpaces(String input) {
|
||||||
|
|||||||
@ -23,6 +23,7 @@ class PasswordKeyPerpetualState {
|
|||||||
RxString beginTime = DateTool().getNowDateWithType(3).obs; //默认为当前时间 开始时间
|
RxString beginTime = DateTool().getNowDateWithType(3).obs; //默认为当前时间 开始时间
|
||||||
RxString endTime = DateTool().getNowDateWithType(3).obs; //默认为当前时间 结束时间
|
RxString endTime = DateTool().getNowDateWithType(3).obs; //默认为当前时间 结束时间
|
||||||
|
|
||||||
|
|
||||||
RxString loopEffectiveDate = DateTool().getNowDateWithType(7).obs; //生效时间
|
RxString loopEffectiveDate = DateTool().getNowDateWithType(7).obs; //生效时间
|
||||||
RxString loopFailureDate = DateTool().getNowDateWithType(7).obs; //失效时间
|
RxString loopFailureDate = DateTool().getNowDateWithType(7).obs; //失效时间
|
||||||
RxInt loopStartHours = DateTime.now().hour.obs;
|
RxInt loopStartHours = DateTime.now().hour.obs;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user