Merge pull request #536 from ente-io/bug_fix_partial_selection

This commit is contained in:
Vishnu Mohandas 2022-09-29 15:47:55 +05:30 committed by GitHub
commit a1c59e80db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,6 +247,7 @@ class RemoteSyncService {
Future<void> syncDeviceCollectionFilesForUpload() async { Future<void> syncDeviceCollectionFilesForUpload() async {
final int ownerID = _config.getUserID(); final int ownerID = _config.getUserID();
final deviceCollections = await _db.getDeviceCollections(); final deviceCollections = await _db.getDeviceCollections();
deviceCollections.removeWhere((element) => !element.shouldBackup); deviceCollections.removeWhere((element) => !element.shouldBackup);
// Sort by count to ensure that photos in iOS are first inserted in // Sort by count to ensure that photos in iOS are first inserted in
@ -256,6 +257,7 @@ class RemoteSyncService {
await _createCollectionsForDevicePath(deviceCollections); await _createCollectionsForDevicePath(deviceCollections);
final Map<String, Set<String>> pathIdToLocalIDs = final Map<String, Set<String>> pathIdToLocalIDs =
await _db.getDevicePathIDToLocalIDMap(); await _db.getDevicePathIDToLocalIDMap();
bool moreFilesMarkedForBackup = false;
for (final deviceCollection in deviceCollections) { for (final deviceCollection in deviceCollections) {
_logger.fine("processing ${deviceCollection.name}"); _logger.fine("processing ${deviceCollection.name}");
final Set<String> localIDsToSync = final Set<String> localIDsToSync =
@ -269,7 +271,7 @@ class RemoteSyncService {
if (localIDsToSync.isEmpty || deviceCollection.collectionID == -1) { if (localIDsToSync.isEmpty || deviceCollection.collectionID == -1) {
continue; continue;
} }
moreFilesMarkedForBackup = true;
await _db.setCollectionIDForUnMappedLocalFiles( await _db.setCollectionIDForUnMappedLocalFiles(
deviceCollection.collectionID, deviceCollection.collectionID,
localIDsToSync, localIDsToSync,
@ -322,6 +324,10 @@ class RemoteSyncService {
} }
} }
} }
if (moreFilesMarkedForBackup && !_config.hasSelectedAllFoldersForBackup()) {
debugPrint("force reload due to display new files");
Bus.instance.fire(ForceReloadHomeGalleryEvent());
}
} }
Future<void> updateDeviceFolderSyncStatus( Future<void> updateDeviceFolderSyncStatus(