Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add large backup standby feature in settings and home gallery

AmanRajSinghMourya6e7ccf8c400d
diff --git a/mobile/apps/photos/lib/settings/local_settings.dart b/mobile/apps/photos/lib/settings/local_settings.dart
index 76f407839d..0691752a66 100644
--- a/mobile/apps/photos/lib/settings/local_settings.dart
+++ b/mobile/apps/photos/lib/settings/local_settings.dart
@@ -89,6 +89,7 @@ class LocalSettings {
static const kShowLocalIDOverThumbnails = "show_local_id_over_thumbnails";
static const kEnableDatabaseLogging = "enable_db_logging";
static const _kInternalUserDisabled = "ls.internal_user_disabled";
+ static const _kLargeBackupStandbyEnabled = "ls.large_backup_standby_enabled";
static const _kBGDebugNotificationsEnabled =
"ls.bg_debug_notifications_enabled";
static const _kCFUploadProxyEnabled = "ls.cf_upload_proxy_enabled";
@@ -522,6 +523,13 @@ class LocalSettings {
await _prefs.setBool(_kInternalUserDisabled, value);
}
+ bool get isLargeBackupStandbyEnabled =>
+ _prefs.getBool(_kLargeBackupStandbyEnabled) ?? false;
+
+ Future<void> setLargeBackupStandbyEnabled(bool value) async {
+ await _prefs.setBool(_kLargeBackupStandbyEnabled, value);
+ }
+
bool get isBGDebugNotificationsEnabled =>
_prefs.getBool(_kBGDebugNotificationsEnabled) ??
(Platform.isAndroid ? false : true);
diff --git a/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart b/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
index 59f6ba3716..2ac18fee6a 100644
--- a/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
@@ -17,6 +17,7 @@ import 'package:photos/models/selected_files.dart';
import "package:photos/service_locator.dart";
import 'package:photos/services/collections_service.dart';
import "package:photos/services/filter/db_filters.dart";
+import "package:photos/services/sync/sync_service.dart";
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
import "package:photos/ui/viewer/gallery/component/group/type.dart";
import 'package:photos/ui/viewer/gallery/gallery.dart';
@@ -79,6 +80,7 @@ class _HomeGalleryWidgetState extends State<HomeGalleryWidget> {
@override
Widget build(BuildContext context) {
+ final largeBackupSession = SyncService.instance.largeBackupSessionTracker;
final gallery = Gallery(
key: ValueKey(_shouldHideSharedItems),
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {
@@ -118,7 +120,9 @@ class _HomeGalleryWidgetState extends State<HomeGalleryWidget> {
return result;
},
- reloadEvent: Bus.instance.on<LocalPhotosUpdatedEvent>(),
+ reloadEvent: Bus.instance.on<LocalPhotosUpdatedEvent>().where(
+ (_) => !largeBackupSession.isStandbyScreenActive,
+ ),
removalEventTypes: const {
EventType.deletedFromRemote,
EventType.deletedFromEverywhere,
@@ -126,8 +130,12 @@ class _HomeGalleryWidgetState extends State<HomeGalleryWidget> {
EventType.hide,
},
forceReloadEvents: [
- Bus.instance.on<BackupFoldersUpdatedEvent>(),
- Bus.instance.on<ForceReloadHomeGalleryEvent>(),
+ Bus.instance.on<BackupFoldersUpdatedEvent>().where(
+ (_) => !largeBackupSession.isStandbyScreenActive,
+ ),
+ Bus.instance.on<ForceReloadHomeGalleryEvent>().where(
+ (_) => !largeBackupSession.isStandbyScreenActive,
+ ),
],
tagPrefix: "home_gallery",
selectedFiles: widget.selectedFiles,
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart
index 19d7c944d1..c994e9c54a 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart
@@ -91,6 +91,19 @@ class BackupSettingsScreen extends StatelessWidget {
],
if (Platform.isIOS) ...[
const SizedBox(height: 24),
+ if (flagService.largeBackupStandby) ...[
+ _toggleItem(
+ context,
+ title: pendingTranslation("(i) Enable large backup standby"),
+ value: () => localSettings.isLargeBackupStandbyEnabled,
+ onChanged: () async {
+ await localSettings.setLargeBackupStandbyEnabled(
+ !localSettings.isLargeBackupStandbyEnabled,
+ );
+ },
+ ),
+ const SizedBox(height: 8),
+ ],
_toggleItem(
context,
title: l10n.disableAutoLock,