Skip to content

armgit / ente

Public Imported from GitHub
0

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

photos: support offline alias and fix landing appbar color

AmanRajSinghMourya4d11c81bdd65
diff --git a/mobile/apps/photos/lib/ui/settings/developer_settings_page.dart b/mobile/apps/photos/lib/ui/settings/developer_settings_page.dart
index 84ff033770..f524931877 100644
--- a/mobile/apps/photos/lib/ui/settings/developer_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/developer_settings_page.dart
@@ -52,9 +52,11 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
const SizedBox(height: 40),
GradientButton(
onTap: () async {
- final url = _urlController.text;
+ final url = _urlController.text.trim();
+ final normalizedInput = url.toLowerCase();
_logger.info("Entered endpoint: $url");
- if (url == "localMode") {
+ if (normalizedInput == "localmode" ||
+ normalizedInput == "offline") {
await localSettings.setAppMode(AppMode.offline);
await localSettings.setShowOfflineModeOption(true);
Bus.instance.fire(AppModeChangedEvent());
@@ -62,7 +64,8 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
Navigator.of(context).pop();
return;
}
- if (url == "onlineMode") {
+ if (normalizedInput == "onlinemode" ||
+ normalizedInput == "online") {
await localSettings.setAppMode(AppMode.online);
Bus.instance.fire(AppModeChangedEvent());
showToast(context, "App mode set to online");
diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
index d00d8d959a..8e09b25d4f 100644
--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart
+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
@@ -824,8 +824,7 @@ class _HomeWidgetState extends State<HomeWidget> {
final isSearchResults =
isOnSearchTab && IndexOfStackNotifier().index == 1;
final isOnLandingPage =
- !Configuration.instance.hasConfiguredAccount() &&
- !isOfflineMode;
+ _shouldShowLandingPageForUnconfiguredAccount();
final isOnOnlineGrantPermissionScreen =
Configuration.instance.hasConfiguredAccount() &&
!isOfflineMode &&
@@ -851,21 +850,14 @@ class _HomeWidgetState extends State<HomeWidget> {
}
Widget _getBody(BuildContext context) {
- final bool offlineMode = isOfflineMode;
if (!Configuration.instance.hasConfiguredAccount()) {
_closeDrawerIfOpen(context);
- final isOfflineEntryFlowEnabled =
- widget.startWithoutAccount && localSettings.showOfflineModeOption;
- final hasPersistedOfflineMode = localSettings.isAppModeSet && offlineMode;
- final canResumePersistedOfflineMode =
- hasPersistedOfflineMode && permissionService.hasGrantedPermissions();
- if (isOfflineEntryFlowEnabled || canResumePersistedOfflineMode) {
- if (_shouldShowPermissionWidget()) {
- return const GrantPermissionsWidget(startWithoutAccount: true);
- }
- } else {
+ if (_shouldShowLandingPageForUnconfiguredAccount()) {
return const LandingPageWidget();
}
+ if (_shouldShowPermissionWidget()) {
+ return const GrantPermissionsWidget(startWithoutAccount: true);
+ }
}
if (flagService.enableOnlyBackupFuturePhotos) {
_ensurePersonSync();
@@ -1175,6 +1167,18 @@ class _HomeWidgetState extends State<HomeWidget> {
}
}
+ bool _shouldShowLandingPageForUnconfiguredAccount() {
+ if (Configuration.instance.hasConfiguredAccount()) {
+ return false;
+ }
+ final isOfflineEntryFlowEnabled =
+ widget.startWithoutAccount && localSettings.showOfflineModeOption;
+ final hasPersistedOfflineMode = localSettings.isAppModeSet && isOfflineMode;
+ final canResumePersistedOfflineMode =
+ hasPersistedOfflineMode && permissionService.hasGrantedPermissions();
+ return !(isOfflineEntryFlowEnabled || canResumePersistedOfflineMode);
+ }
+
bool _shouldShowLoadingWidget() {
if (isOfflineMode) {
return false;