修改删除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 {
print("11111111$deviceConnectionState");
if(deviceConnectionState == DeviceConnectionState.connected){
print("2222222:$deviceConnectionState");
if(isShowLoading){
EasyLoading.show();
Future.delayed(const Duration(seconds: 10), () { //asynchronous delay
@ -228,8 +230,10 @@ class BlueManage{
}
connectStateCallBack!(deviceConnectionState!);
}else{
print("333333333:${deviceConnectionState}");
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) {
blockDeletNumberCheckPasswordCallback();
if(state.currentDeviceUUid.value.isEmpty){
Toast.show(msg: "未扫描到当前设备,请确保您在设备旁边、设备已开启、设备未被其他人连接");
return;
}
if(state.currentDeviceUUid.value[31] == "1"){
// if(state.currentDeviceUUid.value.isEmpty){
// Toast.show(msg: "未扫描到当前设备,请确保您在设备旁边、设备已开启、设备未被其他人连接");
// return;
// }
// if(state.currentDeviceUUid.value[31] == "1"){
//
if(state.getKeyInfosData.value.isLockOwner == 1){
//
@ -250,16 +250,16 @@ class LockSetLogic extends BaseGetXController {
//
deletUserAction();
}
}else if(state.currentDeviceUUid.value[31] == "0"){
//
if(state.getKeyInfosData.value.isLockOwner == 1){
//
deletLockInfoData();
}else{
//
deletKeyData();
}
}
// }else if(state.currentDeviceUUid.value[31] == "0"){
// //
// if(state.getKeyInfosData.value.isLockOwner == 1){
// //
// deletLockInfoData();
// }else{
// //
// deletKeyData();
// }
// }
}
}

View File

@ -440,7 +440,7 @@ class LockDetailLogic extends BaseGetXController{
BlueManage().connectDeviceMacAddress = v[knownDeviceIndex].id;
connectBlue(v[knownDeviceIndex].id, state.keyInfos.value.bluetooth!.bluetoothDeviceName!);
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(
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
() {
// BlueManage().stopScan();
BlueManage().stopScan();
Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo);
}),
];

View File

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

View File

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