修复添加锁时从所有锁进入引起的权限问题
This commit is contained in:
parent
a527b4337f
commit
85d7401ed2
@ -663,17 +663,17 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
|
||||
Future<void> 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) {
|
||||
|
||||
@ -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<void> 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();
|
||||
|
||||
@ -190,7 +190,8 @@ class _SelectLockTypePageState extends State<SelectLockTypePage> with BaseWidget
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
CommonDataManage().seletLockType = 0;
|
||||
Get.toNamed(Routers.nearbyLockPage);
|
||||
logic.getNearByLimits();
|
||||
// Get.toNamed(Routers.nearbyLockPage);
|
||||
},
|
||||
child: view,
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user