2022-05-07 12:20:47 +02:00
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
import 'package:nc_photos/stream_extension.dart';
|
2023-08-31 20:34:48 +02:00
|
|
|
import 'package:np_platform_permission/np_platform_permission.dart';
|
2022-05-07 12:20:47 +02:00
|
|
|
|
|
|
|
Future<Map<String, int>> requestPermissionsForResult(
|
|
|
|
List<String> permissions) async {
|
|
|
|
Map<String, int>? result;
|
|
|
|
final resultFuture = Permission.stream
|
|
|
|
.whereType<PermissionRequestResult>()
|
|
|
|
.first
|
|
|
|
.then((ev) => result = ev.grantResults);
|
|
|
|
await Permission.request(permissions);
|
|
|
|
await resultFuture;
|
|
|
|
_log.info("[requestPermissionsForResult] Result: $result");
|
|
|
|
return result!;
|
|
|
|
}
|
|
|
|
|
|
|
|
final _log = Logger("mobile.android.permission_util");
|