From fca2d8ff2ec6bc6b6a935c03fe1e1008823f4c59 Mon Sep 17 00:00:00 2001 From: dali Date: Sat, 2 Apr 2022 10:01:14 +0100 Subject: [PATCH] fix : fix permission check (#245) * put permission check in if clause because permission check done by third party lib only for android --- lib/src/controller/osm/osm_controller.dart | 8 +++++--- lib/src/widgets/mobile_osm_flutter.dart | 14 +------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/lib/src/controller/osm/osm_controller.dart b/lib/src/controller/osm/osm_controller.dart index 24117818..359ede14 100644 --- a/lib/src/controller/osm/osm_controller.dart +++ b/lib/src/controller/osm/osm_controller.dart @@ -386,9 +386,11 @@ class MobileOSMController extends IBaseOSMController { /// activate current location position Future currentLocation() async { - bool granted = await _osmFlutterState.requestPermission(); - if (!granted) { - throw Exception("Location permission not granted"); + if(Platform.isAndroid){ + bool granted = await _osmFlutterState.requestPermission(); + if (!granted) { + throw Exception("Location permission not granted"); + } } // bool isEnabled = await _osmFlutterState.checkService(); // if (!isEnabled) { diff --git a/lib/src/widgets/mobile_osm_flutter.dart b/lib/src/widgets/mobile_osm_flutter.dart index 0dc36f8c..43744929 100644 --- a/lib/src/widgets/mobile_osm_flutter.dart +++ b/lib/src/widgets/mobile_osm_flutter.dart @@ -207,19 +207,7 @@ class MobileOsmFlutterState extends State return false; } } - // _permission = await location.hasPermission(); - // if (_permission == PermissionStatus.denied) { - // //request location permission - // _permission = await location.requestPermission(); - // if (_permission == PermissionStatus.granted) { - // return true; - // } - // return false; - // } else if (_permission == PermissionStatus.granted) { - // return true; - // // if (widget.currentLocation) await _checkServiceLocation(); - // } - return false; + return true; } // Future checkService() async {