fix(mobile): Fix background backup on iOS (#4038)

This commit is contained in:
Alex 2023-09-11 17:31:15 +07:00 committed by GitHub
parent fd6ade2b5d
commit 47ea47ce14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

11
mobile/.vscode/settings.json vendored Normal file
View File

@ -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
}
}

View File

@ -218,6 +218,9 @@ class BackupService {
bool anyErrors = false;
final List<String> 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();