修改删除bug

This commit is contained in:
魏少阳 2023-10-20 14:25:05 +08:00
parent 96572aeecf
commit bd04a5a9b3
6 changed files with 29 additions and 23 deletions

View File

@ -216,7 +216,9 @@ class BlueManage{
// //
Future<void> judgeReconnect(String deviceMAC, String deviceName, ConnectStateCallBack? connectStateCallBack, {bool isShowLoading = true}) async { Future<void> judgeReconnect(String deviceMAC, String deviceName, ConnectStateCallBack? connectStateCallBack, {bool isShowLoading = true}) async {
print("11111111$deviceConnectionState");
if(deviceConnectionState == DeviceConnectionState.connected){ if(deviceConnectionState == DeviceConnectionState.connected){
print("2222222:$deviceConnectionState");
if(isShowLoading){ if(isShowLoading){
EasyLoading.show(); EasyLoading.show();
Future.delayed(const Duration(seconds: 10), () { //asynchronous delay Future.delayed(const Duration(seconds: 10), () { //asynchronous delay
@ -228,8 +230,10 @@ class BlueManage{
} }
connectStateCallBack!(deviceConnectionState!); connectStateCallBack!(deviceConnectionState!);
}else{ }else{
print("333333333:${deviceConnectionState}");
connect(deviceMAC, deviceName, isShowLoading: false, connectStateCallBack: (state){ connect(deviceMAC, deviceName, isShowLoading: false, connectStateCallBack: (state){
connectStateCallBack!(deviceConnectionState!); print("44444444:${state}");
connectStateCallBack!(state);
}); });
} }
} }

View File

@ -237,11 +237,11 @@ class LockSetLogic extends BaseGetXController {
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
blockDeletNumberCheckPasswordCallback(); blockDeletNumberCheckPasswordCallback();
if(state.currentDeviceUUid.value.isEmpty){ // if(state.currentDeviceUUid.value.isEmpty){
Toast.show(msg: "未扫描到当前设备,请确保您在设备旁边、设备已开启、设备未被其他人连接"); // Toast.show(msg: "未扫描到当前设备,请确保您在设备旁边、设备已开启、设备未被其他人连接");
return; // return;
} // }
if(state.currentDeviceUUid.value[31] == "1"){ // if(state.currentDeviceUUid.value[31] == "1"){
// //
if(state.getKeyInfosData.value.isLockOwner == 1){ if(state.getKeyInfosData.value.isLockOwner == 1){
// //
@ -250,16 +250,16 @@ class LockSetLogic extends BaseGetXController {
// //
deletUserAction(); deletUserAction();
} }
}else if(state.currentDeviceUUid.value[31] == "0"){ // }else if(state.currentDeviceUUid.value[31] == "0"){
// // //
if(state.getKeyInfosData.value.isLockOwner == 1){ // if(state.getKeyInfosData.value.isLockOwner == 1){
// // //
deletLockInfoData(); // deletLockInfoData();
}else{ // }else{
// // //
deletKeyData(); // deletKeyData();
} // }
} // }
} }
} }

View File

@ -440,7 +440,7 @@ class LockDetailLogic extends BaseGetXController{
BlueManage().connectDeviceMacAddress = v[knownDeviceIndex].id; BlueManage().connectDeviceMacAddress = v[knownDeviceIndex].id;
connectBlue(v[knownDeviceIndex].id, state.keyInfos.value.bluetooth!.bluetoothDeviceName!); connectBlue(v[knownDeviceIndex].id, state.keyInfos.value.bluetooth!.bluetoothDeviceName!);
eventBus.fire(ScanAllDeviceFindCurrentDeviceConnectedEvent(v[knownDeviceIndex].serviceUuids[0].toString())); eventBus.fire(ScanAllDeviceFindCurrentDeviceConnectedEvent(v[knownDeviceIndex].serviceUuids[0].toString()));
// BlueManage().stopScan(); BlueManage().stopScan();
} }
}); });
} }

View File

@ -367,7 +367,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
bottomItem( bottomItem(
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
() { () {
// BlueManage().stopScan(); BlueManage().stopScan();
Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo); Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo);
}), }),
]; ];

View File

@ -11,7 +11,7 @@ class AddLockLogic extends BaseGetXController {
// TODO: implement onReady // TODO: implement onReady
super.onReady(); super.onReady();
BlueManage().stopScan(); // BlueManage().stopScan();
} }
@override @override

View File

@ -29,10 +29,12 @@ class NearbyLockLogic extends BaseGetXController{
// //
void connect(String lockId, String deviceName){ void connect(String lockId, String deviceName){
// BlueManage().stopScan(); // BlueManage().stopScan();
BlueManage().judgeReconnect(lockId, deviceName, (DeviceConnectionState state) async { // BlueManage().judgeReconnect(lockId, deviceName, (DeviceConnectionState state) async {
IoSenderManage.getPublicKey(lockId: deviceName); // if (state == DeviceConnectionState.connected) {
}, isShowLoading: true); // IoSenderManage.getPublicKey(lockId: deviceName);
// BlueManage().connect(lockId, deviceName, isFrist: true, isShowLoading: true); // }
// }, isShowLoading: true);
BlueManage().connect(lockId, deviceName, isFrist: true, isShowLoading: true);
} }
// //