diff --git a/i18n/en.json b/i18n/en.json index 99902ac468..b9a99a7de6 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -902,6 +902,7 @@ "enable": "Enable", "enable_backup": "Enable Backup", "enable_biometric_auth_description": "Enter your PIN code to enable biometric authentication", + "enable_notifications": "Enable notifications", "enabled": "Enabled", "end_date": "End date", "enqueued": "Enqueued", diff --git a/mobile/ios/Podfile.lock b/mobile/ios/Podfile.lock index 9bff8cd8e2..e7121a3d23 100644 --- a/mobile/ios/Podfile.lock +++ b/mobile/ios/Podfile.lock @@ -1,4 +1,6 @@ PODS: + - app_settings (5.1.1): + - Flutter - background_downloader (0.0.1): - Flutter - bonsoir_darwin (0.0.1): @@ -133,6 +135,7 @@ PODS: - Flutter DEPENDENCIES: + - app_settings (from `.symlinks/plugins/app_settings/ios`) - background_downloader (from `.symlinks/plugins/background_downloader/ios`) - bonsoir_darwin (from `.symlinks/plugins/bonsoir_darwin/darwin`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) @@ -178,6 +181,8 @@ SPEC REPOS: - SwiftyGif EXTERNAL SOURCES: + app_settings: + :path: ".symlinks/plugins/app_settings/ios" background_downloader: :path: ".symlinks/plugins/background_downloader/ios" bonsoir_darwin: @@ -246,6 +251,7 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/wakelock_plus/ios" SPEC CHECKSUMS: + app_settings: 5127ae0678de1dcc19f2293271c51d37c89428b2 background_downloader: 50e91d979067b82081aba359d7d916b3ba5fadad bonsoir_darwin: 29c7ccf356646118844721f36e1de4b61f6cbd0e connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd diff --git a/mobile/lib/pages/backup/drift_backup.page.dart b/mobile/lib/pages/backup/drift_backup.page.dart index ad688b824e..cdd49a7d4d 100644 --- a/mobile/lib/pages/backup/drift_backup.page.dart +++ b/mobile/lib/pages/backup/drift_backup.page.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'dart:io'; +import 'package:app_settings/app_settings.dart'; import 'package:auto_route/auto_route.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -9,6 +9,7 @@ import 'package:immich_mobile/domain/models/album/local_album.model.dart'; import 'package:immich_mobile/domain/models/store.model.dart'; import 'package:immich_mobile/entities/store.entity.dart'; import 'package:immich_mobile/extensions/build_context_extensions.dart'; +import 'package:immich_mobile/extensions/platform_extensions.dart'; import 'package:immich_mobile/extensions/theme_extensions.dart'; import 'package:immich_mobile/extensions/translate_extensions.dart'; import 'package:immich_mobile/generated/intl_keys.g.dart'; @@ -116,6 +117,11 @@ class _DriftBackupPageState extends ConsumerState { icon: const Icon(Icons.arrow_back_ios_rounded), ), actions: [ + IconButton( + icon: const Icon(Icons.cloud_upload), + onPressed: () => context.pushRoute(const DriftUploadDetailRoute()), + tooltip: "view_details".t(context: context), + ), IconButton( onPressed: () { context.pushRoute(const DriftBackupOptionsRoute()); @@ -172,13 +178,27 @@ class _DriftBackupPageState extends ConsumerState { .watch(appSettingsServiceProvider) .getSetting(AppSettingsEnum.enableBackup); - if (snapshot.hasData && !snapshot.data! && Platform.isAndroid && isBackupEnabled) { + final isGranted = snapshot.data ?? false; + + if (isBackupEnabled && !isGranted && CurrentPlatform.isAndroid) { return Padding( - padding: const EdgeInsets.only(top: 4, bottom: 8), - child: Text( - "notification_backup_reliability".t(), - style: context.textTheme.bodySmall?.copyWith(color: context.colorScheme.onSurfaceSecondary), - textAlign: TextAlign.center, + padding: const EdgeInsets.only(top: 8, bottom: 8), + child: Column( + spacing: 0, + children: [ + Text( + "notification_backup_reliability".t(), + style: context.textTheme.bodySmall?.copyWith( + color: context.colorScheme.onSurfaceSecondary, + ), + textAlign: TextAlign.center, + ), + TextButton.icon( + onPressed: () => AppSettings.openAppSettings(type: AppSettingsType.notification), + icon: const Icon(Icons.open_in_new, size: 16), + label: Text("enable_notifications".t()), + ), + ], ), ); } else { @@ -186,11 +206,6 @@ class _DriftBackupPageState extends ConsumerState { } }, ), - TextButton.icon( - icon: const Icon(Icons.info_outline_rounded), - onPressed: () => context.pushRoute(const DriftUploadDetailRoute()), - label: Text("view_details".t(context: context)), - ), ], ], ), diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock index 4857bb79d6..23f1aa9a83 100644 --- a/mobile/pubspec.lock +++ b/mobile/pubspec.lock @@ -33,6 +33,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + app_settings: + dependency: "direct main" + description: + name: app_settings + sha256: "3e46c561441e5820d3a25339bf8b51b9e45a5f686873851a20c257a530917795" + url: "https://pub.dev" + source: hosted + version: "6.1.1" archive: dependency: transitive description: diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index 64e223bf48..1dbc50913a 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -9,6 +9,7 @@ environment: flutter: 3.35.6 dependencies: + app_settings: ^6.1.1 async: ^2.11.0 auto_route: ^9.2.0 background_downloader: ^9.2.5