fix:调整配网逻辑

This commit is contained in:
liyi 2025-04-26 15:51:16 +08:00
parent 5f079fb3d4
commit 96367baaea

View File

@ -55,7 +55,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
}
///
void updateNetworkInfo({
Future<LoginEntity> updateNetworkInfo({
required String peerId,
required String wifiName,
required String secretKey,
@ -71,27 +71,12 @@ class ConfiguringWifiLogic extends BaseGetXController {
secretKey: secretKey,
peerId: peerId,
);
if (entity.errorCode!.codeIsSuccessful) {
// peerID
StartChartManage().lockNetworkInfo = DeviceNetworkInfo(
wifiName: wifiName,
networkMac: networkMac,
secretKey: secretKey,
peerId: peerId,
);
await _getUploadLockSet();
} else {
dismissEasyLoading();
showToast('网络配置失败,请重试'.tr);
state.sureBtnState.value = 0;
}
return entity;
} catch (e) {
dismissEasyLoading();
showToast('网络配置异常:${e.toString()}'.tr);
state.sureBtnState.value = 0;
AppLog.log('网络配置异常:$e');
return LoginEntity();
}
}
@ -174,19 +159,34 @@ class ConfiguringWifiLogic extends BaseGetXController {
throw Exception('Missing required network information');
}
/// ,peerId
StartChartManage().lockPeerId = peerId;
//
await Storage.saveLockNetWorkInfo(jsonMap);
// - : sureBtnState updateNetworkInfo
updateNetworkInfo(
final info = await updateNetworkInfo(
peerId: peerId,
wifiName: wifiName ?? '',
secretKey: secretKey,
deviceMac: deviceMac ?? '',
networkMac: networkMac ?? '');
if (info.errorCode!.codeIsSuccessful) {
// peerID
StartChartManage().lockNetworkInfo = DeviceNetworkInfo(
wifiName: wifiName,
networkMac: networkMac,
secretKey: secretKey,
peerId: peerId,
);
/// ,peerId
StartChartManage().lockPeerId = peerId;
//
await Storage.saveLockNetWorkInfo(jsonMap);
await _getUploadLockSet();
} else {
dismissEasyLoading();
showToast('网络配置失败,请重试'.tr);
state.sureBtnState.value = 0;
}
} catch (e) {
if (EasyLoading.isShow) {
dismissEasyLoading();
@ -495,13 +495,13 @@ class ConfiguringWifiLogic extends BaseGetXController {
throw Exception('Token is empty');
}
final List<int> getTokenList = changeStringListToIntList(token);
//
await _uploadLockSet(getTokenList);
} catch (e) {
if (EasyLoading.isShow) {
dismissEasyLoading();
}
cancelBlueConnetctToastTimer();
showToast('获取设置失败:${e.toString()}'.tr);
state.sureBtnState.value = 0;
}
}
@ -613,14 +613,14 @@ class ConfiguringWifiLogic extends BaseGetXController {
if (EasyLoading.isShow) {
dismissEasyLoading();
}
showToast('数据上传失败:${entity.errorCode}'.tr);
// showToast('数据上传失败:${entity.errorCode}'.tr);
state.sureBtnState.value = 0; //
}
} catch (e) {
if (EasyLoading.isShow) {
dismissEasyLoading();
}
showToast('数据上传异常:${e.toString()}'.tr);
// showToast('数据上传异常:${e.toString()}'.tr);
state.sureBtnState.value = 0; //
}
}