Merge pull request #31 from ente-io/android_perm_check
This commit is contained in:
commit
31a9aca08e
1 changed files with 9 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:computer/computer.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
@ -54,6 +55,14 @@ class LocalSyncService {
|
|||
_logger.info("Skipping local sync since permission has not been granted");
|
||||
return;
|
||||
}
|
||||
if (Platform.isAndroid && !_isBackground) {
|
||||
final permissionState = await PhotoManager.requestPermissionExtend();
|
||||
if (permissionState != PermissionState.authorized) {
|
||||
_logger.severe("sync requested with invalid permission",
|
||||
permissionState.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
final existingLocalFileIDs = await _db.getExistingLocalFileIDs();
|
||||
_logger.info(
|
||||
existingLocalFileIDs.length.toString() + " localIDs were discovered");
|
||||
|
|
Loading…
Add table
Reference in a new issue