修复首次添加完锁之后,iOS系统开锁提示锁已被重置问题

This commit is contained in:
魏少阳 2024-07-31 13:54:48 +08:00
parent 1aa818402b
commit 696a2884d2
4 changed files with 18 additions and 10 deletions

View File

@ -470,10 +470,10 @@ abstract class Routers {
static const String addIrisTypeManagePage = '/AddIrisTypeManagePage'; // static const String addIrisTypeManagePage = '/AddIrisTypeManagePage'; //
static const String addIrisPage = '/AddIrisPage'; // static const String addIrisPage = '/AddIrisPage'; //
static const String palmListPage = '/PalmListPage'; // static const String palmListPage = '/PalmListPage'; //
static const String addPalmTypePage = '/AddPalmTypePage'; // static const String addPalmTypePage = '/AddPalmTypePage'; //
static const String addPalmPage = '/AddPalmPage'; // static const String addPalmPage = '/AddPalmPage'; //
static const String palmDetailPage = '/PalmDetailPage'; // static const String palmDetailPage = '/PalmDetailPage'; //
static const String passwordKeyDetailChangeDatePage = static const String passwordKeyDetailChangeDatePage =
'/passwordKeyDetailChangeDatePage'; // '/passwordKeyDetailChangeDatePage'; //

View File

@ -285,8 +285,7 @@ class BlueManage {
{bool isAddEquipment = false}) async { {bool isAddEquipment = false}) async {
FlutterBluePlus.isSupported.then((bool isAvailable) async { FlutterBluePlus.isSupported.then((bool isAvailable) async {
if (isAvailable) { if (isAvailable) {
AppLog.log( // AppLog.log('蓝牙状态 系统蓝牙状态:$_adapterState 蓝牙连接状态:$bluetoothConnectionState');
'蓝牙状态 系统蓝牙状态:$_adapterState 蓝牙连接状态:$bluetoothConnectionState');
if (_adapterState == BluetoothAdapterState.on) { if (_adapterState == BluetoothAdapterState.on) {
// //
if (bluetoothConnectionState != BluetoothConnectionState.connected) { if (bluetoothConnectionState != BluetoothConnectionState.connected) {
@ -336,11 +335,13 @@ class BlueManage {
}); });
} else if (isAddEquipment == false && isExistDevice == false) { } else if (isAddEquipment == false && isExistDevice == false) {
//使 //使
// AppLog.log('无存在设备需要扫描 deviceName:$deviceName isAddEquipment:$isAddEquipment');
startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) { startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) {
_connectDevice(scanDevices, deviceName, connectStateCallBack, _connectDevice(scanDevices, deviceName, connectStateCallBack,
isAddEquipment: isAddEquipment); isAddEquipment: isAddEquipment);
}); });
} else { } else {
// AppLog.log('安卓或者iOS 存在设备不需要扫描 deviceName:$deviceName isAddEquipment:$isAddEquipment');
_connectDevice(devicesList, deviceName, connectStateCallBack, _connectDevice(devicesList, deviceName, connectStateCallBack,
isAddEquipment: isAddEquipment); isAddEquipment: isAddEquipment);
} }
@ -372,8 +373,8 @@ class BlueManage {
: devicesList[knownDeviceIndex].device.platformName; : devicesList[knownDeviceIndex].device.platformName;
bluetoothConnectDevice = devicesList[knownDeviceIndex].device; bluetoothConnectDevice = devicesList[knownDeviceIndex].device;
// AppLog.log('bluetoothConnectDevice: $bluetoothConnectDevice');
scanResult = devicesList[knownDeviceIndex]; scanResult = devicesList[knownDeviceIndex];
// AppLog.log('bluetoothConnectDevice: $bluetoothConnectDevice scanResult:$scanResult');
_initGetMtuSubscription(); _initGetMtuSubscription();
_initListenConnectionState(); _initListenConnectionState();
@ -381,7 +382,7 @@ class BlueManage {
if (scanResult == null || connectDeviceMacAddress.isEmpty) { if (scanResult == null || connectDeviceMacAddress.isEmpty) {
return; return;
} }
// AppLog.log("调用了停止扫描的方法"); AppLog.log('调用了停止扫描的方法');
await stopScan(); await stopScan();
if ((scanResult.advertisementData.serviceUuids[0].toString()[31] == '0') && if ((scanResult.advertisementData.serviceUuids[0].toString()[31] == '0') &&
@ -389,6 +390,11 @@ class BlueManage {
connectStateCallBack(BluetoothConnectionState.disconnected); connectStateCallBack(BluetoothConnectionState.disconnected);
EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds); EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
scanDevices.clear(); scanDevices.clear();
startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) {
_connectDevice(scanDevices, deviceName, connectStateCallBack,
isAddEquipment: isAddEquipment);
});
return; return;
} }
// //

View File

@ -1125,7 +1125,7 @@ class _LockDetailPageState extends State<LockDetailPage>
if (state.keyInfos.value.lockFeature!.palmVein == 1) { if (state.keyInfos.value.lockFeature!.palmVein == 1) {
showWidgetArr.add( showWidgetArr.add(
bottomItem( bottomItem(
'images/main/icon_palm.png', ''.tr, state.bottomBtnisEable.value, 'images/main/icon_palm.png', '静脉'.tr, state.bottomBtnisEable.value,
() { () {
Get.toNamed(Routers.palmListPage, arguments: <String, int?>{ Get.toNamed(Routers.palmListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId, 'lockId': state.keyInfos.value.lockId,

View File

@ -469,7 +469,9 @@ class SaveLockLogic extends BaseGetXController {
void backAction() { void backAction() {
eventBus.fire(RefreshLockListInfoDataEvent(clearScanDevices: true)); eventBus.fire(RefreshLockListInfoDataEvent(clearScanDevices: true));
BlueManage().disconnect(); BlueManage().disconnect();
Get.close(state.isFromMap == 1 ? (CommonDataManage().seletLockType == 0 ? 4 : 5) : (CommonDataManage().seletLockType == 0 ? 5 : 6)); Future<void>.delayed(const Duration(seconds: 1), () {
Get.close(state.isFromMap == 1 ? (CommonDataManage().seletLockType == 0 ? 4 : 5) : (CommonDataManage().seletLockType == 0 ? 5 : 6));
});
// 2 // 2
Future<void>.delayed(const Duration(milliseconds: 200), () { Future<void>.delayed(const Duration(milliseconds: 200), () {
if (Get.isRegistered<LockDetailLogic>()) { if (Get.isRegistered<LockDetailLogic>()) {