diff --git a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index f34fa137..61f35c3c 100755 --- a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -663,17 +663,17 @@ class NearbyLockLogic extends BaseGetXController { Future getNearByLimits() async { if (!Platform.isIOS) { - bool bluetoothRequest = false; - try { - bluetoothRequest = await PermissionDialog.requestBluetooth(); - AppLog.log('bluetoothRequest:$bluetoothRequest'); - if (!bluetoothRequest) { - return; - } - } catch (e) { - AppLog.log('bluetoothRequest:$e'); - } - + // bool bluetoothRequest = false; + // try { + // bluetoothRequest = await PermissionDialog.requestBluetooth(); + // AppLog.log('bluetoothRequest:$bluetoothRequest'); + // if (!bluetoothRequest) { + // return; + // } + // } catch (e) { + // AppLog.log('bluetoothRequest:$e'); + // } + final bool bluetoothRequest = await PermissionDialog.requestBluetooth(); final bool locationRequest = await PermissionDialog.request(Permission.location); AppLog.log('locationRequest:$locationRequest'); if (!bluetoothRequest || !locationRequest) { diff --git a/lib/mine/addLock/selectLockType/selectLockType_logic.dart b/lib/mine/addLock/selectLockType/selectLockType_logic.dart index 2e5d8186..2f74b71d 100755 --- a/lib/mine/addLock/selectLockType/selectLockType_logic.dart +++ b/lib/mine/addLock/selectLockType/selectLockType_logic.dart @@ -1,7 +1,13 @@ +import 'dart:io'; + +import 'package:get/get.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/commonDataManage.dart'; +import '../../../appRouters.dart'; import '../../../network/api_repository.dart'; +import '../../../widget/permission/permission_dialog.dart'; import 'selectLockType_state.dart'; class SelectLockTypeLogic extends BaseGetXController { @@ -13,6 +19,19 @@ class SelectLockTypeLogic extends BaseGetXController { } } + //跳转到附近的锁页面先判断权限 + Future getNearByLimits() async { + if (!Platform.isIOS) { + final bool locationRequest = await PermissionDialog.request(Permission.location); + final bool bluetoothRequest = await PermissionDialog.requestBluetooth(); + if (!bluetoothRequest || !locationRequest) { + return; + } + } + + Get.toNamed(Routers.nearbyLockPage); + } + @override void onInit() { super.onInit(); diff --git a/lib/mine/addLock/selectLockType/selectLockType_page.dart b/lib/mine/addLock/selectLockType/selectLockType_page.dart index c7646ac5..bbd8fff8 100755 --- a/lib/mine/addLock/selectLockType/selectLockType_page.dart +++ b/lib/mine/addLock/selectLockType/selectLockType_page.dart @@ -190,7 +190,8 @@ class _SelectLockTypePageState extends State with BaseWidget return GestureDetector( onTap: () { CommonDataManage().seletLockType = 0; - Get.toNamed(Routers.nearbyLockPage); + logic.getNearByLimits(); + // Get.toNamed(Routers.nearbyLockPage); }, child: view, );