mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-22 06:59:21 +01:00
Add a confirmation dialog before signing out
This commit is contained in:
parent
b6d14ba442
commit
2c6351dc9b
3 changed files with 72 additions and 11 deletions
|
@ -1423,6 +1423,15 @@
|
||||||
"@setAsTooltip": {
|
"@setAsTooltip": {
|
||||||
"description": "e.g., set as wallpaper"
|
"description": "e.g., set as wallpaper"
|
||||||
},
|
},
|
||||||
|
"deleteAccountConfirmDialogText": "You are about to sign out from {server}",
|
||||||
|
"@deleteAccountConfirmDialogText": {
|
||||||
|
"description": "Confirmation dialog when deleting an account (i.e., signing out)",
|
||||||
|
"placeholders": {
|
||||||
|
"server": {
|
||||||
|
"example": "http://www.example.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"errorUnauthenticated": "Unauthenticated access. Please sign-in again if the problem continues",
|
"errorUnauthenticated": "Unauthenticated access. Please sign-in again if the problem continues",
|
||||||
"@errorUnauthenticated": {
|
"@errorUnauthenticated": {
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
"removeCollectionsFailedNotification",
|
"removeCollectionsFailedNotification",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
],
|
],
|
||||||
|
|
||||||
"de": [
|
"de": [
|
||||||
|
@ -108,6 +109,7 @@
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip",
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText",
|
||||||
"errorAlbumDowngrade"
|
"errorAlbumDowngrade"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -219,7 +221,8 @@
|
||||||
"removeCollectionsFailedNotification",
|
"removeCollectionsFailedNotification",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
],
|
],
|
||||||
|
|
||||||
"es": [
|
"es": [
|
||||||
|
@ -230,7 +233,8 @@
|
||||||
"searchLandingPeopleListEmptyText2",
|
"searchLandingPeopleListEmptyText2",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
],
|
],
|
||||||
|
|
||||||
"fi": [
|
"fi": [
|
||||||
|
@ -241,7 +245,8 @@
|
||||||
"searchLandingPeopleListEmptyText2",
|
"searchLandingPeopleListEmptyText2",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
],
|
],
|
||||||
|
|
||||||
"fr": [
|
"fr": [
|
||||||
|
@ -372,7 +377,8 @@
|
||||||
"removeCollectionsFailedNotification",
|
"removeCollectionsFailedNotification",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
],
|
],
|
||||||
|
|
||||||
"it": [
|
"it": [
|
||||||
|
@ -678,6 +684,7 @@
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip",
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText",
|
||||||
"errorUnauthenticated",
|
"errorUnauthenticated",
|
||||||
"errorDisconnected",
|
"errorDisconnected",
|
||||||
"errorLocked",
|
"errorLocked",
|
||||||
|
@ -1029,6 +1036,7 @@
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip",
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText",
|
||||||
"errorUnauthenticated",
|
"errorUnauthenticated",
|
||||||
"errorDisconnected",
|
"errorDisconnected",
|
||||||
"errorLocked",
|
"errorLocked",
|
||||||
|
@ -1181,7 +1189,8 @@
|
||||||
"removeCollectionsFailedNotification",
|
"removeCollectionsFailedNotification",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
],
|
],
|
||||||
|
|
||||||
"pt": [
|
"pt": [
|
||||||
|
@ -1203,7 +1212,8 @@
|
||||||
"removeCollectionsFailedNotification",
|
"removeCollectionsFailedNotification",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
],
|
],
|
||||||
|
|
||||||
"ru": [
|
"ru": [
|
||||||
|
@ -1330,7 +1340,8 @@
|
||||||
"removeCollectionsFailedNotification",
|
"removeCollectionsFailedNotification",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
],
|
],
|
||||||
|
|
||||||
"zh": [
|
"zh": [
|
||||||
|
@ -1457,7 +1468,8 @@
|
||||||
"removeCollectionsFailedNotification",
|
"removeCollectionsFailedNotification",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
],
|
],
|
||||||
|
|
||||||
"zh_Hant": [
|
"zh_Hant": [
|
||||||
|
@ -1584,6 +1596,7 @@
|
||||||
"removeCollectionsFailedNotification",
|
"removeCollectionsFailedNotification",
|
||||||
"accountSettingsTooltip",
|
"accountSettingsTooltip",
|
||||||
"contributorsTooltip",
|
"contributorsTooltip",
|
||||||
"setAsTooltip"
|
"setAsTooltip",
|
||||||
|
"deleteAccountConfirmDialogText"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,12 +356,22 @@ class _AccountView extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final accountLabel = AccountPref.of(account).getAccountLabel();
|
||||||
return _AccountTile(
|
return _AccountTile(
|
||||||
account: account,
|
account: account,
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
tooltip: L10n.global().deleteTooltip,
|
tooltip: L10n.global().deleteTooltip,
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
|
final result = await showDialog<bool>(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => _DeleteAccountConfirmDialog(
|
||||||
|
accountLabel: accountLabel ?? account.address,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (!context.mounted || result != true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
context.read<_Bloc>().add(_DeleteAccount(account));
|
context.read<_Bloc>().add(_DeleteAccount(account));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -468,3 +478,32 @@ class _AboutChin extends StatelessWidget {
|
||||||
|
|
||||||
static final _seed = Random().nextInt(65536);
|
static final _seed = Random().nextInt(65536);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _DeleteAccountConfirmDialog extends StatelessWidget {
|
||||||
|
const _DeleteAccountConfirmDialog({
|
||||||
|
required this.accountLabel,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
content: Text(L10n.global().deleteAccountConfirmDialogText(accountLabel)),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop(false);
|
||||||
|
},
|
||||||
|
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop(true);
|
||||||
|
},
|
||||||
|
child: Text(MaterialLocalizations.of(context).okButtonLabel),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String accountLabel;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue