Merge branch 'develop_liyi' into 'canary_release'
bug调整 See merge request StarlockTeam/app-starlock!9
This commit is contained in:
commit
85da5a4648
@ -1151,5 +1151,8 @@
|
||||
"请将手机切换至2.4G WiFi进行手动连接": "Please switch your phone to 2.4G WiFi for manual connection",
|
||||
"请确保网络是2.4GHz Wi-Fi": "Please ensure that the network is 2.4GHz Wi Fi",
|
||||
"是否要远程开锁": "Do you want to unlock remotely",
|
||||
"国家地区的选择将影响数据安全,你当前选择的是": "The choice of country or region will affect data security. What is your current choice",
|
||||
"请确认后再继续": "Please confirm before continuing",
|
||||
"此功能的开启和关闭只能在锁附近通过手机蓝牙进行": "The activation and deactivation of this feature can only be done through Bluetooth on the phone near the lock",
|
||||
"网关添加成功": "Gateway added successfully"
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@
|
||||
"升级": "更新",
|
||||
"空闲": "空置",
|
||||
"已入住": "佔領",
|
||||
"多语言": "語言",
|
||||
"多语言": "多語言",
|
||||
"添加锁": "添加鎖",
|
||||
"锁地址": "鎖定地址",
|
||||
"选择锁类型": "選擇鎖類型",
|
||||
@ -1149,5 +1149,7 @@
|
||||
"2.在APP里开启锁的远程开锁功能(这个功能默认是关闭的)。如果没有这个选项,则锁不支持Google Home": "2.喺APP中開啟鎖嘅遠程解鎖功能(此功能默認關閉)。 如果此選項不可用,則鎖將唔撐Google Home",
|
||||
"3.安装Google Home APP,点击左上角的加号按钮": "3.安裝Google Home應用,點擊左上角嘅加號掣",
|
||||
"暂无最新记录": "目前冇可用嘅最新記錄",
|
||||
"繁体中文(中国台湾)": "繁體中文(中國臺灣)",
|
||||
"繁体中文(中国香港)": "繁體中文(中國香港)",
|
||||
"请将手机切换至2.4G WiFi进行手动连接": "請把手機切換到2.4G WiFi進行手動連接"
|
||||
}
|
||||
@ -1156,5 +1156,10 @@
|
||||
"请确保网络是2.4GHz Wi-Fi": "请确保网络是2.4GHz Wi-Fi",
|
||||
"已选": "已选",
|
||||
"是否要远程开锁": "是否要远程开锁",
|
||||
"繁体中文(中国台湾)": "繁体中文(中国台湾)",
|
||||
"繁体中文(中国香港)": "繁体中文(中国香港)",
|
||||
"国家地区的选择将影响数据安全,你当前选择的是": "国家地区的选择将影响数据安全,你当前选择的是",
|
||||
"请确认后再继续": "请确认后再继续",
|
||||
"此功能的开启和关闭只能在锁附近通过手机蓝牙进行": "此功能的开启和关闭只能在锁附近通过手机蓝牙进行",
|
||||
"网关添加成功": "网关添加成功"
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@
|
||||
"升级": "更新",
|
||||
"空闲": "空缺",
|
||||
"已入住": "已占用",
|
||||
"多语言": "語言",
|
||||
"多语言": "多語言",
|
||||
"添加锁": "添加鎖定",
|
||||
"锁地址": "鎖地址",
|
||||
"选择锁类型": "選擇鎖定類型",
|
||||
@ -1149,5 +1149,7 @@
|
||||
"2.在APP里开启锁的远程开锁功能(这个功能默认是关闭的)。如果没有这个选项,则锁不支持Google Home": "2. 在APP中開啓鎖的遠程開鎖功能(默認關閉)。如果這個選項不可用,鎖將不支持谷歌Home",
|
||||
"3.安装Google Home APP,点击左上角的加号按钮": "3. 安裝谷歌Home應用程序並單擊左上角的加號按鈕",
|
||||
"暂无最新记录": "目前沒有最新的記錄",
|
||||
"繁体中文(中国台湾)": "繁體中文(中國臺灣)",
|
||||
"繁体中文(中国香港)": "繁體中文(中國香港)",
|
||||
"请将手机切换至2.4G WiFi进行手动连接": "手動連接時請將手機調至2.4G WiFi"
|
||||
}
|
||||
@ -62,6 +62,8 @@
|
||||
"批量授权锁": "批量授权锁",
|
||||
"授权管理员拥有操作这把锁的重要权限,请确保只发给我你信任的人": "授权管理员拥有操作这把锁的重要权限,请确保只发给我你信任的人",
|
||||
"功能开启后,你将可以通过网关远程开锁。此功能的开启和关闭只能在锁附近通过手机蓝牙进行。": "功能开启后,你将可以通过网关远程开锁。此功能的开启和关闭只能在锁附近通过手机蓝牙进行。",
|
||||
"此功能的开启和关闭只能在锁附近通过手机蓝牙进行": "此功能的开启和关闭只能在锁附近通过手机蓝牙进行",
|
||||
|
||||
"功能开启后,你将可以通过网关远程开锁。": "功能开启后,你将可以通过网关远程开锁。",
|
||||
"排列方式": "排列方式",
|
||||
"早到榜": "早到榜",
|
||||
@ -1156,5 +1158,9 @@
|
||||
"请确保网络是2.4GHz Wi-Fi": "请确保网络是2.4GHz Wi-Fi",
|
||||
"已选": "已选",
|
||||
"是否要远程开锁": "是否要远程开锁",
|
||||
"繁体中文(中国台湾)": "繁体中文(中国台湾)",
|
||||
"繁体中文(中国香港)": "繁体中文(中国香港)",
|
||||
"国家地区的选择将影响数据安全,你当前选择的是": "国家地区的选择将影响数据安全,你当前选择的是",
|
||||
"请确认后再继续": "请确认后再继续",
|
||||
"网关添加成功": "网关添加成功"
|
||||
}
|
||||
|
||||
@ -57,7 +57,20 @@ class CommandReciverManager {
|
||||
if (data.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int dataSize = data.length;
|
||||
|
||||
// 验证CRC校验
|
||||
if (dataSize >= 2) {
|
||||
final int calculatedCrc =
|
||||
_calculateCRC16(data.sublist(0, dataSize - 2), dataSize - 2);
|
||||
final int receivedCrc = (data[dataSize - 2] << 8) | data[dataSize - 1];
|
||||
|
||||
if (calculatedCrc != receivedCrc) {
|
||||
AppLog.log('CRC校验失败');
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 当小于包头加起来13个字节
|
||||
if (dataSize < 13) {
|
||||
return;
|
||||
@ -123,6 +136,16 @@ class CommandReciverManager {
|
||||
}
|
||||
}
|
||||
|
||||
// CRC16 校验计算
|
||||
static int _calculateCRC16(List<int> bytes, int len) {
|
||||
int value = 0x0000;
|
||||
for (int i = 0; i < len; i++) {
|
||||
int tmp = _reverse8(bytes[i]);
|
||||
value = ((value << 8) ^ _crcTable[(value >> 8) ^ tmp & 0xFF]) & 0xFFFF;
|
||||
}
|
||||
return _reverse16(value);
|
||||
}
|
||||
|
||||
static Future<Reply?> parseData(List<int> data) async {
|
||||
if (data.isNotEmpty) {
|
||||
final int cmd = data[0] * 256 + data[1];
|
||||
@ -472,4 +495,282 @@ class CommandReciverManager {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// CRC16 查找表
|
||||
static const List<int> _crcTable = [
|
||||
0x0000,
|
||||
0x1021,
|
||||
0x2042,
|
||||
0x3063,
|
||||
0x4084,
|
||||
0x50a5,
|
||||
0x60c6,
|
||||
0x70e7,
|
||||
0x8108,
|
||||
0x9129,
|
||||
0xa14a,
|
||||
0xb16b,
|
||||
0xc18c,
|
||||
0xd1ad,
|
||||
0xe1ce,
|
||||
0xf1ef,
|
||||
0x1231,
|
||||
0x0210,
|
||||
0x3273,
|
||||
0x2252,
|
||||
0x52b5,
|
||||
0x4294,
|
||||
0x72f7,
|
||||
0x62d6,
|
||||
0x9339,
|
||||
0x8318,
|
||||
0xb37b,
|
||||
0xa35a,
|
||||
0xd3bd,
|
||||
0xc39c,
|
||||
0xf3ff,
|
||||
0xe3de,
|
||||
0x2462,
|
||||
0x3443,
|
||||
0x0420,
|
||||
0x1401,
|
||||
0x64e6,
|
||||
0x74c7,
|
||||
0x44a4,
|
||||
0x5485,
|
||||
0xa56a,
|
||||
0xb54b,
|
||||
0x8528,
|
||||
0x9509,
|
||||
0xe5ee,
|
||||
0xf5cf,
|
||||
0xc5ac,
|
||||
0xd58d,
|
||||
0x3653,
|
||||
0x2672,
|
||||
0x1611,
|
||||
0x0630,
|
||||
0x76d7,
|
||||
0x66f6,
|
||||
0x5695,
|
||||
0x46b4,
|
||||
0xb75b,
|
||||
0xa77a,
|
||||
0x9719,
|
||||
0x8738,
|
||||
0xf7df,
|
||||
0xe7fe,
|
||||
0xd79d,
|
||||
0xc7bc,
|
||||
0x48c4,
|
||||
0x58e5,
|
||||
0x6886,
|
||||
0x78a7,
|
||||
0x0840,
|
||||
0x1861,
|
||||
0x2802,
|
||||
0x3823,
|
||||
0xc9cc,
|
||||
0xd9ed,
|
||||
0xe98e,
|
||||
0xf9af,
|
||||
0x8948,
|
||||
0x9969,
|
||||
0xa90a,
|
||||
0xb92b,
|
||||
0x5af5,
|
||||
0x4ad4,
|
||||
0x7ab7,
|
||||
0x6a96,
|
||||
0x1a71,
|
||||
0x0a50,
|
||||
0x3a33,
|
||||
0x2a12,
|
||||
0xdbfd,
|
||||
0xcbdc,
|
||||
0xfbbf,
|
||||
0xeb9e,
|
||||
0x9b79,
|
||||
0x8b58,
|
||||
0xbb3b,
|
||||
0xab1a,
|
||||
0x6ca6,
|
||||
0x7c87,
|
||||
0x4ce4,
|
||||
0x5cc5,
|
||||
0x2c22,
|
||||
0x3c03,
|
||||
0x0c60,
|
||||
0x1c41,
|
||||
0xedae,
|
||||
0xfd8f,
|
||||
0xcdec,
|
||||
0xddcd,
|
||||
0xad2a,
|
||||
0xbd0b,
|
||||
0x8d68,
|
||||
0x9d49,
|
||||
0x7e97,
|
||||
0x6eb6,
|
||||
0x5ed5,
|
||||
0x4ef4,
|
||||
0x3e13,
|
||||
0x2e32,
|
||||
0x1e51,
|
||||
0x0e70,
|
||||
0xff9f,
|
||||
0xefbe,
|
||||
0xdfdd,
|
||||
0xcffc,
|
||||
0xbf1b,
|
||||
0xaf3a,
|
||||
0x9f59,
|
||||
0x8f78,
|
||||
0x9188,
|
||||
0x81a9,
|
||||
0xb1ca,
|
||||
0xa1eb,
|
||||
0xd10c,
|
||||
0xc12d,
|
||||
0xf14e,
|
||||
0xe16f,
|
||||
0x1080,
|
||||
0x00a1,
|
||||
0x30c2,
|
||||
0x20e3,
|
||||
0x5004,
|
||||
0x4025,
|
||||
0x7046,
|
||||
0x6067,
|
||||
0x83b9,
|
||||
0x9398,
|
||||
0xa3fb,
|
||||
0xb3da,
|
||||
0xc33d,
|
||||
0xd31c,
|
||||
0xe37f,
|
||||
0xf35e,
|
||||
0x02b1,
|
||||
0x1290,
|
||||
0x22f3,
|
||||
0x32d2,
|
||||
0x4235,
|
||||
0x5214,
|
||||
0x6277,
|
||||
0x7256,
|
||||
0xb5ea,
|
||||
0xa5cb,
|
||||
0x95a8,
|
||||
0x8589,
|
||||
0xf56e,
|
||||
0xe54f,
|
||||
0xd52c,
|
||||
0xc50d,
|
||||
0x34e2,
|
||||
0x24c3,
|
||||
0x14a0,
|
||||
0x0481,
|
||||
0x7466,
|
||||
0x6447,
|
||||
0x5424,
|
||||
0x4405,
|
||||
0xa7db,
|
||||
0xb7fa,
|
||||
0x8799,
|
||||
0x97b8,
|
||||
0xe75f,
|
||||
0xf77e,
|
||||
0xc71d,
|
||||
0xd73c,
|
||||
0x26d3,
|
||||
0x36f2,
|
||||
0x0691,
|
||||
0x16b0,
|
||||
0x6657,
|
||||
0x7676,
|
||||
0x4615,
|
||||
0x5634,
|
||||
0xd94c,
|
||||
0xc96d,
|
||||
0xf90e,
|
||||
0xe92f,
|
||||
0x99c8,
|
||||
0x89e9,
|
||||
0xb98a,
|
||||
0xa9ab,
|
||||
0x5844,
|
||||
0x4865,
|
||||
0x7806,
|
||||
0x6827,
|
||||
0x18c0,
|
||||
0x08e1,
|
||||
0x3882,
|
||||
0x28a3,
|
||||
0xcb7d,
|
||||
0xdb5c,
|
||||
0xeb3f,
|
||||
0xfb1e,
|
||||
0x8bf9,
|
||||
0x9bd8,
|
||||
0xabbb,
|
||||
0xbb9a,
|
||||
0x4a75,
|
||||
0x5a54,
|
||||
0x6a37,
|
||||
0x7a16,
|
||||
0x0af1,
|
||||
0x1ad0,
|
||||
0x2ab3,
|
||||
0x3a92,
|
||||
0xfd2e,
|
||||
0xed0f,
|
||||
0xdd6c,
|
||||
0xcd4d,
|
||||
0xbdaa,
|
||||
0xad8b,
|
||||
0x9de8,
|
||||
0x8dc9,
|
||||
0x7c26,
|
||||
0x6c07,
|
||||
0x5c64,
|
||||
0x4c45,
|
||||
0x3ca2,
|
||||
0x2c83,
|
||||
0x1ce0,
|
||||
0x0cc1,
|
||||
0xef1f,
|
||||
0xff3e,
|
||||
0xcf5d,
|
||||
0xdf7c,
|
||||
0xaf9b,
|
||||
0xbfba,
|
||||
0x8fd9,
|
||||
0x9ff8,
|
||||
0x6e17,
|
||||
0x7e36,
|
||||
0x4e55,
|
||||
0x5e74,
|
||||
0x2e93,
|
||||
0x3eb2,
|
||||
0x0ed1,
|
||||
0x1ef0
|
||||
];
|
||||
|
||||
// 8位字节反转
|
||||
static int _reverse8(int data) {
|
||||
int temp = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
temp |= ((data >> i) & 0x01) << (7 - i);
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
// 16位字反转
|
||||
static int _reverse16(int data) {
|
||||
int temp = 0;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
temp |= ((data >> i) & 0x0001) << (15 - i);
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,7 +263,12 @@ class SM4 {
|
||||
0x48
|
||||
];
|
||||
|
||||
static const List<int> FK = <int>[0xA3B1BAC6, 0x56AA3350, 0x677D9197, 0xB27022DC];
|
||||
static const List<int> FK = <int>[
|
||||
0xA3B1BAC6,
|
||||
0x56AA3350,
|
||||
0x677D9197,
|
||||
0xB27022DC
|
||||
];
|
||||
|
||||
static const List<int> CK = <int>[
|
||||
0x00070e15,
|
||||
@ -411,11 +416,27 @@ class SM4 {
|
||||
}
|
||||
return paddedList;
|
||||
} else {
|
||||
// 解密时去除PKCS7填充
|
||||
final int lastByte = input.last;
|
||||
if (lastByte > 0 && lastByte <= blockSize) {
|
||||
// 验证填充是否合法
|
||||
bool isValidPadding = true;
|
||||
for (int i = input.length - lastByte; i < input.length; i++) {
|
||||
if (input[i] != lastByte) {
|
||||
isValidPadding = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isValidPadding) {
|
||||
return input.sublist(0, input.length - lastByte);
|
||||
}
|
||||
}
|
||||
return input;
|
||||
// final lastByte = input.last;
|
||||
// final cutLen = input.length - lastByte;
|
||||
// AppLog.log("object input.length:${input.length} lastByte:$lastByte input:$input cutLen:$cutLen");
|
||||
// // AppLog.log("object input.length:${input.length} lastByte:$lastByte input:$input cutLen:$cutLen");
|
||||
// return input.sublist(0, cutLen);
|
||||
return input;
|
||||
// return input;
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,7 +501,8 @@ class SM4 {
|
||||
final List<int> supplementList = List.filled(16, 0x00);
|
||||
|
||||
/// complete list
|
||||
final List<int> completeList = <int>[...list, ...supplementList].sublist(0, 16);
|
||||
final List<int> completeList =
|
||||
<int>[...list, ...supplementList].sublist(0, 16);
|
||||
return completeList;
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
||||
final StarLockForgetPasswordState state = StarLockForgetPasswordState();
|
||||
|
||||
late Timer _timer;
|
||||
|
||||
void _startTimer() {
|
||||
_timer = Timer.periodic(1.seconds, (Timer timer) {
|
||||
if (state.currentSecond > 1) {
|
||||
@ -37,12 +38,12 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
Future<void> resetPassword() async {
|
||||
if(state.pwd.value != state.surePwd.value){
|
||||
if (state.pwd.value != state.surePwd.value) {
|
||||
showToast('两次密码不一致哦'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!RegularExpression().validateString(state.pwd.value)){
|
||||
if (!RegularExpression().validateString(state.pwd.value)) {
|
||||
showToast('密码需至少包含数字/字母/字符中的2种组合'.tr);
|
||||
return;
|
||||
}
|
||||
@ -56,42 +57,44 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
||||
state.verificationCode.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
ApmHelper.instance.trackEvent('resetPassword_result', {
|
||||
'account':state.phoneStr.value,
|
||||
'date':DateTool().getNowDateWithType(1),
|
||||
'resetPassword_res':'成功',
|
||||
'account': state.phoneStr.value,
|
||||
'date': DateTool().getNowDateWithType(1),
|
||||
'resetPassword_res': '成功',
|
||||
});
|
||||
|
||||
showToast('重置成功'.tr);
|
||||
Get.back();
|
||||
}else{
|
||||
} else {
|
||||
ApmHelper.instance.trackEvent('resetPassword_result', {
|
||||
'account':state.phoneStr.value,
|
||||
'date':DateTool().getNowDateWithType(1),
|
||||
'resetPassword_res':'${entity.errorCode}--${entity.errorMsg}',
|
||||
'account': state.phoneStr.value,
|
||||
'date': DateTool().getNowDateWithType(1),
|
||||
'resetPassword_res': '${entity.errorCode}--${entity.errorMsg}',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> sendValidationCode() async {
|
||||
final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeUnLogin(
|
||||
// state.countryCode.value,
|
||||
countryCode:state.countryCode.value,
|
||||
account:state.phoneStr.value,
|
||||
channel:state.codeType.value,
|
||||
codeType:'2',
|
||||
xWidth:state.xWidth.value.toString());
|
||||
final SendValidationCodeEntity entity =
|
||||
await ApiRepository.to.sendValidationCodeUnLogin(
|
||||
// state.countryCode.value,
|
||||
countryCode: state.countryCode.value,
|
||||
account: state.phoneStr.value,
|
||||
channel: state.codeType.value,
|
||||
codeType: '2',
|
||||
xWidth: state.xWidth.value.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
_startTimer();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> checkIpAction() async {
|
||||
final CheckIPEntity entity = await ApiRepository.to.checkIpAction(
|
||||
ip: ''
|
||||
);
|
||||
final CheckIPEntity entity = await ApiRepository.to.checkIpAction(ip: '');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if(state.countryName.value == entity.data!.name){
|
||||
ShowTipView().showSureAlertDialog('国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续'.tr, tipTitle: '确认国家或地区'.tr, sureStr: '我知道了'.tr);
|
||||
if (state.countryName.value != entity.data!.name) {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
'国家地区的选择将影响数据安全,你当前选择的是' + state.countryName.value + '请确认后再继续'.tr,
|
||||
tipTitle: '确认国家或地区'.tr,
|
||||
sureStr: '我知道了'.tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -103,9 +106,9 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
||||
void changeInput(TextEditingController controller) {
|
||||
if (controller == state.phoneController) {
|
||||
state.phoneStr.value = controller.text;
|
||||
if(state.phoneStr.value.contains('@')){
|
||||
if (state.phoneStr.value.contains('@')) {
|
||||
state.codeType.value = '2';
|
||||
}else{
|
||||
} else {
|
||||
state.codeType.value = '1';
|
||||
}
|
||||
}
|
||||
@ -120,11 +123,13 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
||||
}
|
||||
_resetCanSendCode();
|
||||
_resetCanSub();
|
||||
AppLog.log('state.canSub.value:${state.canSub.value} state.pwdIsOK:${state.pwdIsOK} state.codeIsOK:${state.codeIsOK} state.phoneStr.value:${state.phoneStr.value}');
|
||||
AppLog.log(
|
||||
'state.canSub.value:${state.canSub.value} state.pwdIsOK:${state.pwdIsOK} state.codeIsOK:${state.codeIsOK} state.phoneStr.value:${state.phoneStr.value}');
|
||||
}
|
||||
|
||||
void _resetCanSub() {
|
||||
state.canSub.value = state.pwdIsOK && state.codeIsOK && state.phoneStr.value.isNotEmpty;
|
||||
state.canSub.value =
|
||||
state.pwdIsOK && state.codeIsOK && state.phoneStr.value.isNotEmpty;
|
||||
}
|
||||
|
||||
void _resetCanSendCode() {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -58,8 +57,7 @@ class _StarLockForgetPasswordPageState
|
||||
children: <Widget>[
|
||||
SizedBox(width: 5.w),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'国家/地区'.tr,
|
||||
child: Text('国家/地区'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp, color: AppColors.blackColor))),
|
||||
SizedBox(width: 20.w),
|
||||
|
||||
@ -141,9 +141,9 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
Future<void> checkIpAction() async {
|
||||
final CheckIPEntity entity = await ApiRepository.to.checkIpAction(ip: '');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (state.countryName == entity.data!.name) {
|
||||
if (state.countryName != entity.data!.name) {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
'国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续'.tr,
|
||||
'国家地区的选择将影响数据安全,你当前选择的是'+state.countryName+'请确认后再继续'.tr,
|
||||
tipTitle: '确认国家或地区'.tr,
|
||||
sureStr: '我知道了'.tr);
|
||||
}
|
||||
|
||||
@ -72,17 +72,6 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
||||
secretKey: secretKey,
|
||||
peerId: peerId,
|
||||
);
|
||||
|
||||
if (state.pageName.value == 'lockSet') {
|
||||
Get.close(2);
|
||||
} else {
|
||||
Get.offAllNamed(Routers.starLockMain);
|
||||
}
|
||||
dismissEasyLoading();
|
||||
if (state.loadingTimer != null) {
|
||||
state.loadingTimer!.cancel();
|
||||
state.loadingTimer = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -398,8 +387,10 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
||||
|
||||
// 上传数据获取设置
|
||||
Future<void> _getUploadLockSet() async {
|
||||
// showBlueConnetctToastTimer(action: (){
|
||||
// });
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState connectionState) async {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
@ -408,10 +399,10 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
||||
|
||||
_uploadLockSet(getTokenList);
|
||||
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||
// cancelBlueConnetctToastTimer();
|
||||
// if(state.ifCurrentScreen.value == true){
|
||||
// showBlueConnetctToast();
|
||||
// }
|
||||
cancelBlueConnetctToastTimer();
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -468,13 +459,23 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
||||
required int recordType,
|
||||
required List records}) async {
|
||||
final LoginEntity entity = await ApiRepository.to.lockDataUpload(
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId!,
|
||||
lockId: state.lockBasicInfo.value.lockId ?? -1,
|
||||
uploadType: uploadType,
|
||||
recordType: recordType,
|
||||
records: records,
|
||||
isUnShowLoading: true);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
update();
|
||||
await Future.delayed((Duration(seconds: 1)));
|
||||
if (state.pageName.value == 'lockSet') {
|
||||
Get.close(2);
|
||||
} else {
|
||||
Get.offAllNamed(Routers.starLockMain);
|
||||
}
|
||||
dismissEasyLoading();
|
||||
if (state.loadingTimer != null) {
|
||||
state.loadingTimer!.cancel();
|
||||
state.loadingTimer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,12 +44,17 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage>
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '确定'.tr,
|
||||
onClick: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
logic.senderConfiguringWifiAction();
|
||||
},
|
||||
Obx(
|
||||
() => SubmitBtn(
|
||||
btnName: '确定'.tr,
|
||||
isDisabled: state.isLoading.isFalse,
|
||||
onClick: state.isLoading.isTrue
|
||||
? null
|
||||
: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
logic.senderConfiguringWifiAction();
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
|
||||
@ -362,7 +362,7 @@ class _LockSetPageState extends State<LockSetPage>
|
||||
//todo: 双重认证、双锁联动国际化、API接口
|
||||
//双重认证
|
||||
Obx(() => Visibility(
|
||||
visible: true,
|
||||
visible: state.lockFeature.value.doubleAuthentication == 1,
|
||||
child: CommonItem(
|
||||
leftTitel: '双重认证'.tr,
|
||||
rightTitle: '',
|
||||
|
||||
@ -35,6 +35,7 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage>
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(30.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@ -65,7 +66,7 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage>
|
||||
}),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20.h),
|
||||
child: Text('功能开启后,你将可以通过网关远程开锁。此功能的开启和关闭只能在锁附近通过手机蓝牙进行。'.tr,
|
||||
child: Text('此功能的开启和关闭只能在锁附近通过手机蓝牙进行'.tr,
|
||||
style: TextStyle(fontSize: 20.sp)),
|
||||
),
|
||||
SizedBox(
|
||||
|
||||
@ -105,6 +105,11 @@ class _NearbyLockPageState extends State<NearbyLockPage> with RouteAware {
|
||||
|
||||
Widget nearbyLockItem(
|
||||
String lockTypeIcon, ScanResult scanResult, Function() action) {
|
||||
// 如果广播名称为空或空字符串,则不显示该项
|
||||
if (scanResult.advertisementData.advName.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
final String? serviceUuid =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user