Skip to content

Commit

Permalink
fix : fix permission check (liodali#245)
Browse files Browse the repository at this point in the history
* put permission check in if clause because permission check done by third party lib only for android
  • Loading branch information
liodali committed Apr 2, 2022
1 parent 2f4c857 commit fca2d8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
8 changes: 5 additions & 3 deletions lib/src/controller/osm/osm_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,11 @@ class MobileOSMController extends IBaseOSMController {

/// activate current location position
Future<void> 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) {
Expand Down
14 changes: 1 addition & 13 deletions lib/src/widgets/mobile_osm_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,7 @@ class MobileOsmFlutterState extends State<MobileOsmFlutter>
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<bool> checkService() async {
Expand Down

0 comments on commit fca2d8f

Please sign in to comment.