|
@@ -52,6 +52,15 @@ class RemoteSyncService {
|
|
bool _isExistingSyncSilent = false;
|
|
bool _isExistingSyncSilent = false;
|
|
|
|
|
|
static const kHasSyncedArchiveKey = "has_synced_archive";
|
|
static const kHasSyncedArchiveKey = "has_synced_archive";
|
|
|
|
+ /* This setting is used to maintain a list of local IDs for videos that the user has manually
|
|
|
|
+ marked for upload, even if the global video upload setting is currently disabled.
|
|
|
|
+ When the global video upload setting is disabled, we typically ignore all video uploads. However, for videos that have been added to this list, we
|
|
|
|
+ want to still allow them to be uploaded, despite the global setting being disabled.
|
|
|
|
+
|
|
|
|
+ This allows users to queue up videos for upload, and have them successfully upload
|
|
|
|
+ even if they later toggle the global video upload setting to disabled.
|
|
|
|
+ */
|
|
|
|
+ static const _ignoreBackUpSettingsForIDs_ = "ignoreBackUpSettingsForIDs";
|
|
final String _isFirstRemoteSyncDone = "isFirstRemoteSyncDone";
|
|
final String _isFirstRemoteSyncDone = "isFirstRemoteSyncDone";
|
|
|
|
|
|
// 28 Sept, 2021 9:03:20 AM IST
|
|
// 28 Sept, 2021 9:03:20 AM IST
|
|
@@ -189,6 +198,18 @@ class RemoteSyncService {
|
|
return _prefs.containsKey(_isFirstRemoteSyncDone);
|
|
return _prefs.containsKey(_isFirstRemoteSyncDone);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Future<bool> whiteListVideoForUpload(EnteFile file) async {
|
|
|
|
+ if (file.fileType == FileType.video &&
|
|
|
|
+ !_config.shouldBackupVideos() &&
|
|
|
|
+ file.localID != null) {
|
|
|
|
+ final List<String> whitelistedIDs =
|
|
|
|
+ _prefs.getStringList(_ignoreBackUpSettingsForIDs_) ?? <String>[];
|
|
|
|
+ whitelistedIDs.add(file.localID!);
|
|
|
|
+ return _prefs.setStringList(_ignoreBackUpSettingsForIDs_, whitelistedIDs);
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
Future<void> _pullDiff() async {
|
|
Future<void> _pullDiff() async {
|
|
_logger.info("Pulling remote diff");
|
|
_logger.info("Pulling remote diff");
|
|
final isFirstSync = !_collectionsService.hasSyncedCollections();
|
|
final isFirstSync = !_collectionsService.hasSyncedCollections();
|
|
@@ -524,8 +545,13 @@ class RemoteSyncService {
|
|
final List<EnteFile> filesToBeUploaded = [];
|
|
final List<EnteFile> filesToBeUploaded = [];
|
|
int ignoredForUpload = 0;
|
|
int ignoredForUpload = 0;
|
|
int skippedVideos = 0;
|
|
int skippedVideos = 0;
|
|
|
|
+ final whitelistedIDs =
|
|
|
|
+ (_prefs.getStringList(_ignoreBackUpSettingsForIDs_) ?? <String>[])
|
|
|
|
+ .toSet();
|
|
for (var file in originalFiles) {
|
|
for (var file in originalFiles) {
|
|
- if (shouldRemoveVideos && file.fileType == FileType.video) {
|
|
|
|
|
|
+ if (shouldRemoveVideos &&
|
|
|
|
+ (file.fileType == FileType.video &&
|
|
|
|
+ !whitelistedIDs.contains(file.localID))) {
|
|
skippedVideos++;
|
|
skippedVideos++;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|