From 47ea47ce14519b953394f259e8e09fad70b47e1e Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 11 Sep 2023 17:31:15 +0700 Subject: [PATCH] fix(mobile): Fix background backup on iOS (#4038) --- mobile/.vscode/settings.json | 11 +++++++++++ .../lib/modules/backup/services/backup.service.dart | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 mobile/.vscode/settings.json diff --git a/mobile/.vscode/settings.json b/mobile/.vscode/settings.json new file mode 100644 index 0000000000..89183ccc38 --- /dev/null +++ b/mobile/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "dart.flutterSdkPath": ".fvm/flutter_sdk", + // Remove .fvm files from search + "search.exclude": { + "**/.fvm": true + }, + // Remove from file watching + "files.watcherExclude": { + "**/.fvm": true + } +} \ No newline at end of file diff --git a/mobile/lib/modules/backup/services/backup.service.dart b/mobile/lib/modules/backup/services/backup.service.dart index 678f3a3867..76da214a4d 100644 --- a/mobile/lib/modules/backup/services/backup.service.dart +++ b/mobile/lib/modules/backup/services/backup.service.dart @@ -218,6 +218,9 @@ class BackupService { bool anyErrors = false; final List duplicatedAssetIds = []; + // DON'T KNOW WHY BUT THIS HELPS BACKGROUND BACKUP TO WORK ON IOS + await PhotoManager.requestPermissionExtend(); + for (var entity in assetList) { try { if (entity.type == AssetType.video) { @@ -248,7 +251,8 @@ class BackupService { req.fields['deviceAssetId'] = entity.id; req.fields['deviceId'] = deviceId; - req.fields['fileCreatedAt'] = entity.createDateTime.toUtc().toIso8601String(); + req.fields['fileCreatedAt'] = + entity.createDateTime.toUtc().toIso8601String(); req.fields['fileModifiedAt'] = entity.modifiedDateTime.toUtc().toIso8601String(); req.fields['isFavorite'] = entity.isFavorite.toString();