mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 07:28:26 +00:00
[mob] Update permission dialog
This commit is contained in:
parent
85735b4ff0
commit
ec7b61c36a
4
mobile/lib/generated/intl/messages_en.dart
generated
4
mobile/lib/generated/intl/messages_en.dart
generated
@ -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":
|
||||
|
20
mobile/lib/generated/l10n.dart
generated
20
mobile/lib/generated/l10n.dart
generated
@ -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(
|
||||
|
@ -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",
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user