Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Update permission dialog

Neeraj Guptaec7b61c36a42
diff --git a/mobile/lib/generated/intl/messages_en.dart b/mobile/lib/generated/intl/messages_en.dart
index 86bbe68e26..dfd0bffcb4 100644
--- a/mobile/lib/generated/intl/messages_en.dart
+++ b/mobile/lib/generated/intl/messages_en.dart
@@ -346,6 +346,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Allow downloads"),
"allowPeopleToAddPhotos":
MessageLookupByLibrary.simpleMessage("Allow people to add photos"),
+ "allowPermBody": MessageLookupByLibrary.simpleMessage(
+ "Please allow access to your photos from Settings so Ente can display and backup your library."),
+ "allowPermTitle":
+ MessageLookupByLibrary.simpleMessage("Allow access to photos"),
"androidBiometricHint":
MessageLookupByLibrary.simpleMessage("Verify identity"),
"androidBiometricNotRecognized":
diff --git a/mobile/lib/generated/l10n.dart b/mobile/lib/generated/l10n.dart
index 79d5aa5574..723efee3c9 100644
--- a/mobile/lib/generated/l10n.dart
+++ b/mobile/lib/generated/l10n.dart
@@ -4916,6 +4916,26 @@ class S {
);
}
+ /// `Allow access to photos`
+ String get allowPermTitle {
+ return Intl.message(
+ 'Allow access to photos',
+ name: 'allowPermTitle',
+ desc: '',
+ args: [],
+ );
+ }
+
+ /// `Please allow access to your photos from Settings so Ente can display and backup your library.`
+ String get allowPermBody {
+ return Intl.message(
+ 'Please allow access to your photos from Settings so Ente can display and backup your library.',
+ name: 'allowPermBody',
+ desc: '',
+ args: [],
+ );
+ }
+
/// `Open Settings`
String get openSettings {
return Intl.message(
diff --git a/mobile/lib/l10n/intl_en.arb b/mobile/lib/l10n/intl_en.arb
index 7c4fbff9fc..c3a69f549d 100644
--- a/mobile/lib/l10n/intl_en.arb
+++ b/mobile/lib/l10n/intl_en.arb
@@ -689,6 +689,8 @@
"noPhotosAreBeingBackedUpRightNow": "No photos are being backed up right now",
"preserveMore": "Preserve more",
"grantFullAccessPrompt": "Please allow access to all photos in the Settings app",
+ "allowPermTitle": "Allow access to photos",
+ "allowPermBody": "Please allow access to your photos from Settings so Ente can display and backup your library.",
"openSettings": "Open Settings",
"selectMorePhotos": "Select more photos",
"existingUser": "Existing user",
diff --git a/mobile/lib/ui/home/grant_permissions_widget.dart b/mobile/lib/ui/home/grant_permissions_widget.dart
index 40f43429b6..147409a28d 100644
--- a/mobile/lib/ui/home/grant_permissions_widget.dart
+++ b/mobile/lib/ui/home/grant_permissions_widget.dart
@@ -5,8 +5,10 @@ import 'package:flutter/material.dart';
import "package:logging/logging.dart";
import 'package:photo_manager/photo_manager.dart';
import "package:photos/generated/l10n.dart";
+import "package:photos/l10n/l10n.dart";
import 'package:photos/services/sync_service.dart';
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/settings/general_section_widget.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/photo_manager_util.dart";
import "package:styled_text/styled_text.dart";
@@ -111,38 +113,16 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
state == PermissionState.limited) {
await SyncService.instance.onPermissionGranted(state);
} else if (state == PermissionState.denied) {
- final AlertDialog alert = AlertDialog(
- title: Text(S.of(context).pleaseGrantPermissions),
- content: Text(
- S.of(context).enteCanEncryptAndPreserveFilesOnlyIfYouGrant,
- ),
- actions: [
- TextButton(
- child: Text(
- S.of(context).ok,
- style:
- Theme.of(context).textTheme.titleMedium!.copyWith(
- fontSize: 14,
- fontWeight: FontWeight.w700,
- ),
- ),
- onPressed: () {
- Navigator.of(context).pop('dialog');
- if (Platform.isIOS) {
- PhotoManager.openSetting();
- }
- },
- ),
- ],
- );
- // ignore: unawaited_futures
- showDialog(
- useRootNavigator: false,
- context: context,
- builder: (BuildContext context) {
- return alert;
+ await showChoiceDialog(
+ context,
+ title: context.l10n.allowPermTitle,
+ body: context.l10n.allowPermBody,
+ firstButtonLabel: context.l10n.openSettings,
+ firstButtonOnTap: () async {
+ if (Platform.isIOS) {
+ await PhotoManager.openSetting();
+ }
},
- barrierColor: Colors.black12,
);
} else {
throw Exception("Unknown permission state: $state");