Ver Fonte

Ignore permission checks if the app is in the background

vishnukvmd há 4 anos atrás
pai
commit
ff10eb1ca4
1 ficheiros alterados com 3 adições e 3 exclusões
  1. 3 3
      lib/services/local_sync_service.dart

+ 3 - 3
lib/services/local_sync_service.dart

@@ -35,6 +35,9 @@ class LocalSyncService {
   Future<void> init(bool isBackground) async {
     _isBackground = isBackground;
     _prefs = await SharedPreferences.getInstance();
+    if (_isBackground) {
+      await PhotoManager.setIgnorePermissionCheck(true);
+    }
     await _computer.turnOn(workersCount: 1);
   }
 
@@ -57,9 +60,6 @@ class LocalSyncService {
     final editedFileIDs = getEditedFileIDs().toSet();
     final downloadedFileIDs = getDownloadedFileIDs().toSet();
     final syncStartTime = DateTime.now().microsecondsSinceEpoch;
-    if (_isBackground) {
-      await PhotoManager.setIgnorePermissionCheck(true);
-    }
     final lastDBUpdationTime = _prefs.getInt(kDbUpdationTimeKey) ?? 0;
     final startTime = DateTime.now().microsecondsSinceEpoch;
     if (lastDBUpdationTime != 0) {