[mob] Add confirmation while adding trusted contact
This commit is contained in:
@@ -228,6 +228,7 @@ class _EmergencyPageState extends State<EmergencyPage> {
|
||||
await routeToPage(
|
||||
context,
|
||||
AddContactPage(info!),
|
||||
forceCustomPageRoute: true,
|
||||
);
|
||||
unawaited(_fetchData());
|
||||
},
|
||||
@@ -249,6 +250,7 @@ class _EmergencyPageState extends State<EmergencyPage> {
|
||||
await routeToPage(
|
||||
context,
|
||||
AddContactPage(info!),
|
||||
forceCustomPageRoute: true,
|
||||
);
|
||||
unawaited(_fetchData());
|
||||
},
|
||||
|
||||
@@ -6,6 +6,7 @@ import "package:photos/emergency/emergency_service.dart";
|
||||
import "package:photos/emergency/model.dart";
|
||||
import "package:photos/generated/l10n.dart";
|
||||
import "package:photos/models/api/collection/user.dart";
|
||||
import "package:photos/models/button_result.dart";
|
||||
import 'package:photos/services/collections_service.dart';
|
||||
import "package:photos/services/user_service.dart";
|
||||
import 'package:photos/theme/ente_theme.dart';
|
||||
@@ -19,6 +20,7 @@ import 'package:photos/ui/components/menu_section_title.dart';
|
||||
import 'package:photos/ui/components/models/button_type.dart';
|
||||
import 'package:photos/ui/sharing/user_avator_widget.dart';
|
||||
import "package:photos/ui/sharing/verify_identity_dialog.dart";
|
||||
import "package:photos/ui/tabs/nav_bar.dart";
|
||||
import "package:photos/utils/dialog_util.dart";
|
||||
|
||||
class AddContactPage extends StatefulWidget {
|
||||
@@ -186,20 +188,32 @@ class _AddContactPage extends State<AddContactPage> {
|
||||
: () async {
|
||||
final emailToAdd =
|
||||
selectedEmail == '' ? _email : selectedEmail;
|
||||
try {
|
||||
final result = await EmergencyContactService
|
||||
.instance
|
||||
.addContact(context, emailToAdd);
|
||||
if (result && mounted) {
|
||||
Navigator.of(context).pop(true);
|
||||
final choiceResult = await showChoiceActionSheet(
|
||||
context,
|
||||
title: S.of(context).warning,
|
||||
body: S.of(context).confirmAddingTrustedContact(
|
||||
emailToAdd,
|
||||
30,
|
||||
),
|
||||
firstButtonLabel: S.of(context).proceed,
|
||||
isCritical: true,
|
||||
);
|
||||
if (choiceResult != null &&
|
||||
choiceResult.action == ButtonAction.first) {
|
||||
try {
|
||||
final r = await EmergencyContactService.instance
|
||||
.addContact(context, emailToAdd);
|
||||
if (r && mounted) {
|
||||
Navigator.of(context).pop(true);
|
||||
}
|
||||
} catch (e) {
|
||||
_logger.severe('Failed to add contact', e);
|
||||
await showErrorDialog(
|
||||
context,
|
||||
S.of(context).error,
|
||||
S.of(context).somethingWentWrong,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
_logger.severe('Failed to add contact', e);
|
||||
await showErrorDialog(
|
||||
context,
|
||||
S.of(context).error,
|
||||
S.of(context).somethingWentWrong,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
22
mobile/lib/generated/intl/messages_en.dart
generated
22
mobile/lib/generated/intl/messages_en.dart
generated
@@ -62,6 +62,9 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
static String m82(count) =>
|
||||
"${Intl.plural(count, zero: 'Added 0 collaborator', one: 'Added 1 collaborator', other: 'Added ${count} collaborators')}";
|
||||
|
||||
static String m83(email, numOfDays) =>
|
||||
"You are about to add ${email} as a trusted contact. They will be able to recover your account if you are absent for ${numOfDays} days.";
|
||||
|
||||
static String m19(familyAdminEmail) =>
|
||||
"Please contact <green>${familyAdminEmail}</green> to manage your subscription";
|
||||
|
||||
@@ -157,13 +160,13 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
|
||||
static String m52(storeName) => "Rate us on ${storeName}";
|
||||
|
||||
static String m83(days, email) =>
|
||||
static String m84(days, email) =>
|
||||
"You can access the account after ${days} days. A notification will be sent to ${email}.";
|
||||
|
||||
static String m84(email) =>
|
||||
static String m85(email) =>
|
||||
"You can now recover ${email}\'s account by setting a new password.";
|
||||
|
||||
static String m85(email) => "${email} is trying to recover your account.";
|
||||
static String m86(email) => "${email} is trying to recover your account.";
|
||||
|
||||
static String m53(storageInGB) =>
|
||||
"3. Both of you get ${storageInGB} GB* free";
|
||||
@@ -232,7 +235,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
static String m73(count) =>
|
||||
"${Intl.plural(count, zero: 'Soon', one: '1 day', other: '${count} days')}";
|
||||
|
||||
static String m86(email) =>
|
||||
static String m87(email) =>
|
||||
"You have been invited to be a legacy contact by ${email}.";
|
||||
|
||||
static String m74(galleryType) =>
|
||||
@@ -575,6 +578,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"Are you sure you want to disable two-factor authentication?"),
|
||||
"confirmAccountDeletion":
|
||||
MessageLookupByLibrary.simpleMessage("Confirm Account Deletion"),
|
||||
"confirmAddingTrustedContact": m83,
|
||||
"confirmDeletePrompt": MessageLookupByLibrary.simpleMessage(
|
||||
"Yes, I want to permanently delete this account and its data across all apps."),
|
||||
"confirmPassword":
|
||||
@@ -1347,6 +1351,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
MessageLookupByLibrary.simpleMessage("Private backups"),
|
||||
"privateSharing":
|
||||
MessageLookupByLibrary.simpleMessage("Private sharing"),
|
||||
"proceed": MessageLookupByLibrary.simpleMessage("Proceed"),
|
||||
"processingImport": m51,
|
||||
"publicLinkCreated":
|
||||
MessageLookupByLibrary.simpleMessage("Public link created"),
|
||||
@@ -1366,7 +1371,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
MessageLookupByLibrary.simpleMessage("Recover account"),
|
||||
"recoveryInitiated":
|
||||
MessageLookupByLibrary.simpleMessage("Recovery initiated"),
|
||||
"recoveryInitiatedDesc": m83,
|
||||
"recoveryInitiatedDesc": m84,
|
||||
"recoveryKey": MessageLookupByLibrary.simpleMessage("Recovery key"),
|
||||
"recoveryKeyCopiedToClipboard": MessageLookupByLibrary.simpleMessage(
|
||||
"Recovery key copied to clipboard"),
|
||||
@@ -1380,12 +1385,12 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
MessageLookupByLibrary.simpleMessage("Recovery key verified"),
|
||||
"recoveryKeyVerifyReason": MessageLookupByLibrary.simpleMessage(
|
||||
"Your recovery key is the only way to recover your photos if you forget your password. You can find your recovery key in Settings > Account.\n\nPlease enter your recovery key here to verify that you have saved it correctly."),
|
||||
"recoveryReady": m84,
|
||||
"recoveryReady": m85,
|
||||
"recoverySuccessful":
|
||||
MessageLookupByLibrary.simpleMessage("Recovery successful!"),
|
||||
"recoveryWarning": MessageLookupByLibrary.simpleMessage(
|
||||
"A trusted contact is trying to access your account"),
|
||||
"recoveryWarningBody": m85,
|
||||
"recoveryWarningBody": m86,
|
||||
"recreatePasswordBody": MessageLookupByLibrary.simpleMessage(
|
||||
"The current device is not powerful enough to verify your password, but we can regenerate in a way that works with all devices.\n\nPlease login using your recovery key and regenerate your password (you can use the same one again if you wish)."),
|
||||
"recreatePasswordTitle":
|
||||
@@ -1772,7 +1777,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"trim": MessageLookupByLibrary.simpleMessage("Trim"),
|
||||
"trustedContacts":
|
||||
MessageLookupByLibrary.simpleMessage("Trusted contacts"),
|
||||
"trustedInviteBody": m86,
|
||||
"trustedInviteBody": m87,
|
||||
"tryAgain": MessageLookupByLibrary.simpleMessage("Try again"),
|
||||
"turnOnBackupForAutoUpload": MessageLookupByLibrary.simpleMessage(
|
||||
"Turn on backup to automatically upload files added to this device folder to Ente."),
|
||||
@@ -1871,6 +1876,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
MessageLookupByLibrary.simpleMessage("Waiting for verification..."),
|
||||
"waitingForWifi":
|
||||
MessageLookupByLibrary.simpleMessage("Waiting for WiFi..."),
|
||||
"warning": MessageLookupByLibrary.simpleMessage("Warning"),
|
||||
"weAreOpenSource":
|
||||
MessageLookupByLibrary.simpleMessage("We are open source!"),
|
||||
"weDontSupportEditingPhotosAndAlbumsThatYouDont":
|
||||
|
||||
30
mobile/lib/generated/l10n.dart
generated
30
mobile/lib/generated/l10n.dart
generated
@@ -10728,6 +10728,36 @@ class S {
|
||||
args: [email],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Warning`
|
||||
String get warning {
|
||||
return Intl.message(
|
||||
'Warning',
|
||||
name: 'warning',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Proceed`
|
||||
String get proceed {
|
||||
return Intl.message(
|
||||
'Proceed',
|
||||
name: 'proceed',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `You are about to add {email} as a trusted contact. They will be able to recover your account if you are absent for {numOfDays} days.`
|
||||
String confirmAddingTrustedContact(String email, int numOfDays) {
|
||||
return Intl.message(
|
||||
'You are about to add $email as a trusted contact. They will be able to recover your account if you are absent for $numOfDays days.',
|
||||
name: 'confirmAddingTrustedContact',
|
||||
desc: '',
|
||||
args: [email, numOfDays],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||
|
||||
@@ -1558,5 +1558,20 @@
|
||||
}
|
||||
},
|
||||
"recoveryWarningBody": "{email} is trying to recover your account.",
|
||||
"trustedInviteBody": "You have been invited to be a legacy contact by {email}."
|
||||
"trustedInviteBody": "You have been invited to be a legacy contact by {email}.",
|
||||
"warning": "Warning",
|
||||
"proceed": "Proceed",
|
||||
"confirmAddingTrustedContact": "You are about to add {email} as a trusted contact. They will be able to recover your account if you are absent for {numOfDays} days.",
|
||||
"@confirmAddingTrustedContact": {
|
||||
"placeholders": {
|
||||
"email": {
|
||||
"type": "String",
|
||||
"example": "me@example.com"
|
||||
},
|
||||
"numOfDays": {
|
||||
"type": "int",
|
||||
"example": "30"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user