20240903 pre release
This commit is contained in:
@ -126,28 +126,27 @@ class PermissionController {
|
||||
_isRequestingPermission = true;
|
||||
_permissionCompleter = Completer<bool>();
|
||||
|
||||
bool hasPermissions = await _checkLocationPermissions();
|
||||
if (!hasPermissions) {
|
||||
bool userAgreed = await showLocationDisclosure();
|
||||
if (userAgreed) {
|
||||
try {
|
||||
await requestAllLocationPermissions();
|
||||
hasPermissions = await _checkLocationPermissions();
|
||||
} catch (e) {
|
||||
print('Error requesting location permissions: $e');
|
||||
try {
|
||||
bool hasPermissions = await _checkLocationPermissions();
|
||||
if (!hasPermissions) {
|
||||
bool userAgreed = await showLocationDisclosure();
|
||||
if (userAgreed) {
|
||||
hasPermissions = await _requestAllLocationPermissions();
|
||||
} else {
|
||||
print('User did not agree to location usage');
|
||||
hasPermissions = false;
|
||||
// アプリを終了
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
} else {
|
||||
print('User did not agree to location usage');
|
||||
hasPermissions = false;
|
||||
// アプリを終了
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
|
||||
_isRequestingPermission = false;
|
||||
_permissionCompleter!.complete(hasPermissions);
|
||||
} catch( e ) {
|
||||
print('Error in permission request: $e');
|
||||
_isRequestingPermission = false;
|
||||
_permissionCompleter!.complete(false);
|
||||
}
|
||||
|
||||
_isRequestingPermission = false;
|
||||
_permissionCompleter!.complete(hasPermissions);
|
||||
|
||||
debugPrint("Finish checkAndRequestPermissions...");
|
||||
return _permissionCompleter!.future;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user