diff --git a/mobile/apps/photos/lib/db/files_db.dart b/mobile/apps/photos/lib/db/files_db.dart index ae5b901ecf..a3a6e4e9b0 100644 --- a/mobile/apps/photos/lib/db/files_db.dart +++ b/mobile/apps/photos/lib/db/files_db.dart @@ -1023,7 +1023,7 @@ class FilesDB with SqlDbBase { // file.pubMmdEncodedJson ?? '{}', // file.pubMmdVersion, file.fileSize, - file.addedTime ?? DateTime.now().microsecondsSinceEpoch, + DateTime.now().microsecondsSinceEpoch, // added Time ]); if (omitCollectionId) { @@ -1037,8 +1037,8 @@ class FilesDB with SqlDbBase { final file = EnteFile(); file.generatedID = row[columnGeneratedID]; file.localID = row[columnLocalID]; - file.uploadedFileID = - row[columnUploadedFileID] == -1 ? null : row[columnUploadedFileID]; + // file.uploadedFileID = + // row[columnUploadedFileID] == -1 ? null : row[columnUploadedFileID]; file.ownerID = row[columnOwnerID]; file.collectionID = row[columnCollectionID] == -1 ? null : row[columnCollectionID]; @@ -1054,7 +1054,6 @@ class FilesDB with SqlDbBase { file.creationTime = row[columnCreationTime]; file.modificationTime = row[columnModificationTime]; file.updationTime = row[columnUpdationTime] ?? -1; - file.addedTime = row[columnAddedTime]; // file.encryptedKey = row[columnEncryptedKey]; // file.keyDecryptionNonce = row[columnKeyDecryptionNonce]; // file.fileDecryptionHeader = row[columnFileDecryptionHeader]; @@ -1069,7 +1068,7 @@ class FilesDB with SqlDbBase { // file.mMdVersion = row[columnMMdVersion] ?? 0; // file.mMdEncodedJson = row[columnMMdEncodedJson] ?? '{}'; - // + // return file; } } diff --git a/mobile/apps/photos/lib/models/file/file.dart b/mobile/apps/photos/lib/models/file/file.dart index a603adc650..29fb171309 100644 --- a/mobile/apps/photos/lib/models/file/file.dart +++ b/mobile/apps/photos/lib/models/file/file.dart @@ -9,7 +9,6 @@ import 'package:photos/models/file/file_type.dart'; import "package:photos/models/file/remote/asset.dart"; import "package:photos/models/file/remote/collection_file.dart"; import 'package:photos/models/location/location.dart'; -import "package:photos/models/metadata/file_magic.dart"; import "package:photos/module/download/file_url.dart"; import "package:photos/services/local/asset_entity.service.dart"; @@ -20,8 +19,8 @@ class EnteFile { RemoteAsset? rAsset; CollectionFile? cf; TrashTime? trashTime; + int? generatedID; - int? uploadedFileID; int? ownerID; int? collectionID; String? localID; @@ -30,7 +29,6 @@ class EnteFile { int? creationTime; int? modificationTime; int? updationTime; - int? addedTime; late Location? location; late FileType fileType; int? fileSubType; @@ -86,6 +84,8 @@ class EnteFile { } } + int? get uploadedFileID => rAsset?.id; + static EnteFile fromRemoteAsset( RemoteAsset rAsset, CollectionFile collection, { @@ -95,8 +95,6 @@ class EnteFile { file.rAsset = rAsset; file.cf = collection; file.lAsset = lAsset; - - file.uploadedFileID = rAsset.id; file.ownerID = rAsset.ownerID; file.title = rAsset.title; file.deviceFolder = rAsset.deviceFolder; @@ -215,7 +213,6 @@ class EnteFile { EnteFile copyWith({ int? generatedID, - int? uploadedFileID, int? ownerID, int? collectionID, String? localID, @@ -224,7 +221,6 @@ class EnteFile { int? creationTime, int? modificationTime, int? updationTime, - int? addedTime, Location? location, FileType? fileType, int? fileSubType, @@ -239,7 +235,6 @@ class EnteFile { ..rAsset = rAsset ..cf = cf ..generatedID = generatedID ?? this.generatedID - ..uploadedFileID = uploadedFileID ?? this.uploadedFileID ..ownerID = ownerID ?? this.ownerID ..collectionID = collectionID ?? this.collectionID ..localID = localID ?? this.localID @@ -248,7 +243,6 @@ class EnteFile { ..creationTime = creationTime ?? this.creationTime ..modificationTime = modificationTime ?? this.modificationTime ..updationTime = updationTime ?? this.updationTime - ..addedTime = addedTime ?? this.addedTime ..location = location ?? this.location ..fileType = fileType ?? this.fileType ..fileSubType = fileSubType ?? this.fileSubType diff --git a/mobile/apps/photos/lib/services/sync/remote_sync_service.dart b/mobile/apps/photos/lib/services/sync/remote_sync_service.dart index fbf662a27b..69989bcd88 100644 --- a/mobile/apps/photos/lib/services/sync/remote_sync_service.dart +++ b/mobile/apps/photos/lib/services/sync/remote_sync_service.dart @@ -159,7 +159,7 @@ class RemoteSyncService { await queueLocalAssetForUpload(); final hasMoreFilesToBackup = (await _getFilesToBeUploaded()).isNotEmpty; _logger.info("hasMoreFilesToBackup?" + hasMoreFilesToBackup.toString()); - if (hasMoreFilesToBackup && !_shouldThrottleSync()) { + if (hasMoreFilesToBackup && !isMultiPartDisabled()) { // Skipping a resync to ensure that files that were ignored in this // session are not processed now await sync(); @@ -382,7 +382,7 @@ class RemoteSyncService { return originalFiles; } final bool shouldRemoveVideos = - !_config.shouldBackupVideos() || _shouldThrottleSync(); + !_config.shouldBackupVideos() || isMultiPartDisabled(); final ignoredIDs = await IgnoredFilesService.instance.idToIgnoreReasonMap; bool shouldSkipUploadFunc(EnteFile file) { return IgnoredFilesService.instance.shouldSkipUpload(ignoredIDs, file); @@ -442,7 +442,7 @@ class RemoteSyncService { final List futures = []; for (final file in filesToBeUploaded) { - if (_shouldThrottleSync() && + if (isMultiPartDisabled() && futures.length >= kMaximumPermissibleUploadsInThrottledMode) { _logger.info("Skipping some new files as we are throttling uploads"); break; @@ -457,7 +457,7 @@ class RemoteSyncService { } for (final uploadedFileID in updatedFileIDs) { - if (_shouldThrottleSync() && + if (isMultiPartDisabled() && futures.length >= kMaximumPermissibleUploadsInThrottledMode) { _logger .info("Skipping some updated files as we are throttling uploads"); @@ -563,7 +563,7 @@ class RemoteSyncService { } } - bool _shouldThrottleSync() { + bool isMultiPartDisabled() { return !flagService.enableMobMultiPart || !localSettings.userEnabledMultiplePart; } @@ -584,21 +584,19 @@ class RemoteSyncService { }); } - bool _shouldShowNotification() { + bool _shouldNotifyNewFiles() { final isForeground = AppLifecycleService.instance.isForeground; final bool showNotification = NotificationService.instance.shouldShowNotificationsForSharedPhotos() && isFirstRemoteSyncDone() && !isForeground; - _logger.info( - " notification: $showNotification isAppInForeground: $isForeground", - ); + _logger.info("notification: $showNotification isAppInFg: $isForeground"); return showNotification; } Future _notifyOnCollectionChange(List collectionIDs) async { try { - if (!_shouldShowNotification()) { + if (!_shouldNotifyNewFiles()) { return; } final userID = Configuration.instance.getUserID();