[mob] Update permission dialog

This commit is contained in:
Neeraj Gupta 2024-12-21 10:21:06 +05:30
parent 85735b4ff0
commit ec7b61c36a
4 changed files with 37 additions and 31 deletions

View File

@ -346,6 +346,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Allow downloads"), MessageLookupByLibrary.simpleMessage("Allow downloads"),
"allowPeopleToAddPhotos": "allowPeopleToAddPhotos":
MessageLookupByLibrary.simpleMessage("Allow people to add photos"), 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": "androidBiometricHint":
MessageLookupByLibrary.simpleMessage("Verify identity"), MessageLookupByLibrary.simpleMessage("Verify identity"),
"androidBiometricNotRecognized": "androidBiometricNotRecognized":

View File

@ -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` /// `Open Settings`
String get openSettings { String get openSettings {
return Intl.message( return Intl.message(

View File

@ -689,6 +689,8 @@
"noPhotosAreBeingBackedUpRightNow": "No photos are being backed up right now", "noPhotosAreBeingBackedUpRightNow": "No photos are being backed up right now",
"preserveMore": "Preserve more", "preserveMore": "Preserve more",
"grantFullAccessPrompt": "Please allow access to all photos in the Settings app", "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", "openSettings": "Open Settings",
"selectMorePhotos": "Select more photos", "selectMorePhotos": "Select more photos",
"existingUser": "Existing user", "existingUser": "Existing user",

View File

@ -5,8 +5,10 @@ import 'package:flutter/material.dart';
import "package:logging/logging.dart"; import "package:logging/logging.dart";
import 'package:photo_manager/photo_manager.dart'; import 'package:photo_manager/photo_manager.dart';
import "package:photos/generated/l10n.dart"; import "package:photos/generated/l10n.dart";
import "package:photos/l10n/l10n.dart";
import 'package:photos/services/sync_service.dart'; import 'package:photos/services/sync_service.dart';
import "package:photos/theme/ente_theme.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/dialog_util.dart";
import "package:photos/utils/photo_manager_util.dart"; import "package:photos/utils/photo_manager_util.dart";
import "package:styled_text/styled_text.dart"; import "package:styled_text/styled_text.dart";
@ -111,38 +113,16 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
state == PermissionState.limited) { state == PermissionState.limited) {
await SyncService.instance.onPermissionGranted(state); await SyncService.instance.onPermissionGranted(state);
} else if (state == PermissionState.denied) { } else if (state == PermissionState.denied) {
final AlertDialog alert = AlertDialog( await showChoiceDialog(
title: Text(S.of(context).pleaseGrantPermissions), context,
content: Text( title: context.l10n.allowPermTitle,
S.of(context).enteCanEncryptAndPreserveFilesOnlyIfYouGrant, body: context.l10n.allowPermBody,
), firstButtonLabel: context.l10n.openSettings,
actions: [ firstButtonOnTap: () async {
TextButton( if (Platform.isIOS) {
child: Text( await PhotoManager.openSetting();
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;
}, },
barrierColor: Colors.black12,
); );
} else { } else {
throw Exception("Unknown permission state: $state"); throw Exception("Unknown permission state: $state");