修复添加锁时从所有锁进入引起的权限问题
This commit is contained in:
parent
a527b4337f
commit
85d7401ed2
@ -663,17 +663,17 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
|
|
||||||
Future<void> getNearByLimits() async {
|
Future<void> getNearByLimits() async {
|
||||||
if (!Platform.isIOS) {
|
if (!Platform.isIOS) {
|
||||||
bool bluetoothRequest = false;
|
// bool bluetoothRequest = false;
|
||||||
try {
|
// try {
|
||||||
bluetoothRequest = await PermissionDialog.requestBluetooth();
|
// bluetoothRequest = await PermissionDialog.requestBluetooth();
|
||||||
AppLog.log('bluetoothRequest:$bluetoothRequest');
|
// AppLog.log('bluetoothRequest:$bluetoothRequest');
|
||||||
if (!bluetoothRequest) {
|
// if (!bluetoothRequest) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
AppLog.log('bluetoothRequest:$e');
|
// AppLog.log('bluetoothRequest:$e');
|
||||||
}
|
// }
|
||||||
|
final bool bluetoothRequest = await PermissionDialog.requestBluetooth();
|
||||||
final bool locationRequest = await PermissionDialog.request(Permission.location);
|
final bool locationRequest = await PermissionDialog.request(Permission.location);
|
||||||
AppLog.log('locationRequest:$locationRequest');
|
AppLog.log('locationRequest:$locationRequest');
|
||||||
if (!bluetoothRequest || !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/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
|
import '../../../appRouters.dart';
|
||||||
import '../../../network/api_repository.dart';
|
import '../../../network/api_repository.dart';
|
||||||
|
import '../../../widget/permission/permission_dialog.dart';
|
||||||
import 'selectLockType_state.dart';
|
import 'selectLockType_state.dart';
|
||||||
|
|
||||||
class SelectLockTypeLogic extends BaseGetXController {
|
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
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|||||||
@ -190,7 +190,8 @@ class _SelectLockTypePageState extends State<SelectLockTypePage> with BaseWidget
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
CommonDataManage().seletLockType = 0;
|
CommonDataManage().seletLockType = 0;
|
||||||
Get.toNamed(Routers.nearbyLockPage);
|
logic.getNearByLimits();
|
||||||
|
// Get.toNamed(Routers.nearbyLockPage);
|
||||||
},
|
},
|
||||||
child: view,
|
child: view,
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user