mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 09:35:12 +00:00
chore: Add descriptions in the areYouSure dialogs for better UX
This commit is contained in:
parent
969dbef09a
commit
67a4bc71ab
7 changed files with 52 additions and 22 deletions
|
@ -2534,5 +2534,12 @@
|
||||||
"seconds": {}
|
"seconds": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pleaseEnterANumber": "Please enter a number greater than 0"
|
"pleaseEnterANumber": "Please enter a number greater than 0",
|
||||||
|
"archiveRoomDescription": "The chat will be moved to the archive. Other users will be able to see that you have left the chat.",
|
||||||
|
"roomUpgradeDescription": "The chat will then be recreated with the new room version. All participants will be notified that they need to switch to the new chat. You can find out more about room versions at https://spec.matrix.org/latest/rooms/",
|
||||||
|
"removeDevicesDescription": "You will be logged out of this device and will no longer be able to receive messages.",
|
||||||
|
"banUserDescription": "The user will be banned from the chat and will not be able to enter the chat again until they are unbanned.",
|
||||||
|
"unbanUserDescription": "The user will be able to enter the chat again if they try.",
|
||||||
|
"kickUserDescription": "The user is kicked out of the chat but not banned. In public chats, the user can rejoin at any time.",
|
||||||
|
"makeAdminDescription": "Once you make this user admin, you may not be able to undo this as they will then have the same permissions as you."
|
||||||
}
|
}
|
||||||
|
|
|
@ -471,6 +471,7 @@ class ChatListController extends State<ChatList>
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
|
message: L10n.of(context)!.archiveRoomDescription,
|
||||||
) ==
|
) ==
|
||||||
OkCancelResult.ok;
|
OkCancelResult.ok;
|
||||||
if (!confirmed) return;
|
if (!confirmed) return;
|
||||||
|
|
|
@ -132,6 +132,7 @@ class ChatListItem extends StatelessWidget {
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
cancelLabel: L10n.of(context)!.no,
|
cancelLabel: L10n.of(context)!.no,
|
||||||
|
message: L10n.of(context)!.archiveRoomDescription,
|
||||||
);
|
);
|
||||||
if (confirmed == OkCancelResult.cancel) return;
|
if (confirmed == OkCancelResult.cancel) return;
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
|
|
|
@ -99,6 +99,7 @@ class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
|
message: L10n.of(context)!.roomUpgradeDescription,
|
||||||
)) {
|
)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
|
message: L10n.of(context)!.removeDevicesDescription,
|
||||||
) ==
|
) ==
|
||||||
OkCancelResult.cancel) return;
|
OkCancelResult.cancel) return;
|
||||||
final matrix = Matrix.of(context);
|
final matrix = Matrix.of(context);
|
||||||
|
|
|
@ -92,15 +92,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
final user = widget.user;
|
final user = widget.user;
|
||||||
final userId = user?.id ?? widget.profile?.userId;
|
final userId = user?.id ?? widget.profile?.userId;
|
||||||
if (userId == null) throw ('user or profile must not be null!');
|
if (userId == null) throw ('user or profile must not be null!');
|
||||||
// ignore: prefer_function_declarations_over_variables
|
|
||||||
final Function askConfirmation = () async => (await showOkCancelAlertDialog(
|
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
|
||||||
title: L10n.of(context)!.areYouSure,
|
|
||||||
okLabel: L10n.of(context)!.yes,
|
|
||||||
cancelLabel: L10n.of(context)!.no,
|
|
||||||
) ==
|
|
||||||
OkCancelResult.ok);
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case UserBottomSheetAction.report:
|
case UserBottomSheetAction.report:
|
||||||
if (user == null) throw ('User must not be null for this action!');
|
if (user == null) throw ('User must not be null for this action!');
|
||||||
|
@ -157,7 +149,15 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
break;
|
break;
|
||||||
case UserBottomSheetAction.ban:
|
case UserBottomSheetAction.ban:
|
||||||
if (user == null) throw ('User must not be null for this action!');
|
if (user == null) throw ('User must not be null for this action!');
|
||||||
if (await askConfirmation()) {
|
if (await showOkCancelAlertDialog(
|
||||||
|
useRootNavigator: false,
|
||||||
|
context: context,
|
||||||
|
title: L10n.of(context)!.areYouSure,
|
||||||
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
cancelLabel: L10n.of(context)!.no,
|
||||||
|
message: L10n.of(context)!.banUserDescription,
|
||||||
|
) ==
|
||||||
|
OkCancelResult.ok) {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => user.ban(),
|
future: () => user.ban(),
|
||||||
|
@ -167,7 +167,15 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
break;
|
break;
|
||||||
case UserBottomSheetAction.unban:
|
case UserBottomSheetAction.unban:
|
||||||
if (user == null) throw ('User must not be null for this action!');
|
if (user == null) throw ('User must not be null for this action!');
|
||||||
if (await askConfirmation()) {
|
if (await showOkCancelAlertDialog(
|
||||||
|
useRootNavigator: false,
|
||||||
|
context: context,
|
||||||
|
title: L10n.of(context)!.areYouSure,
|
||||||
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
cancelLabel: L10n.of(context)!.no,
|
||||||
|
message: L10n.of(context)!.unbanUserDescription,
|
||||||
|
) ==
|
||||||
|
OkCancelResult.ok) {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => user.unban(),
|
future: () => user.unban(),
|
||||||
|
@ -177,7 +185,15 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
break;
|
break;
|
||||||
case UserBottomSheetAction.kick:
|
case UserBottomSheetAction.kick:
|
||||||
if (user == null) throw ('User must not be null for this action!');
|
if (user == null) throw ('User must not be null for this action!');
|
||||||
if (await askConfirmation()) {
|
if (await showOkCancelAlertDialog(
|
||||||
|
useRootNavigator: false,
|
||||||
|
context: context,
|
||||||
|
title: L10n.of(context)!.areYouSure,
|
||||||
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
cancelLabel: L10n.of(context)!.no,
|
||||||
|
message: L10n.of(context)!.kickUserDescription,
|
||||||
|
) ==
|
||||||
|
OkCancelResult.ok) {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => user.kick(),
|
future: () => user.kick(),
|
||||||
|
@ -192,7 +208,16 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
currentLevel: user.powerLevel,
|
currentLevel: user.powerLevel,
|
||||||
);
|
);
|
||||||
if (newPermission != null) {
|
if (newPermission != null) {
|
||||||
if (newPermission == 100 && await askConfirmation() == false) break;
|
if (newPermission == 100 &&
|
||||||
|
await showOkCancelAlertDialog(
|
||||||
|
useRootNavigator: false,
|
||||||
|
context: context,
|
||||||
|
title: L10n.of(context)!.areYouSure,
|
||||||
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
cancelLabel: L10n.of(context)!.no,
|
||||||
|
message: L10n.of(context)!.makeAdminDescription,
|
||||||
|
) ==
|
||||||
|
OkCancelResult.ok) break;
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => user.setPower(newPermission),
|
future: () => user.setPower(newPermission),
|
||||||
|
@ -212,14 +237,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
Navigator.of(context, rootNavigator: false).pop();
|
Navigator.of(context, rootNavigator: false).pop();
|
||||||
break;
|
break;
|
||||||
case UserBottomSheetAction.ignore:
|
case UserBottomSheetAction.ignore:
|
||||||
if (await askConfirmation()) {
|
context.go('/rooms/settings/security/ignorelist');
|
||||||
await showFutureLoadingDialog(
|
|
||||||
context: context,
|
|
||||||
future: () => Matrix.of(widget.outerContext)
|
|
||||||
.client
|
|
||||||
.ignoreUser(user?.id ?? widget.profile!.userId),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
|
message: L10n.of(context)!.archiveRoomDescription,
|
||||||
);
|
);
|
||||||
if (confirmed == OkCancelResult.ok) {
|
if (confirmed == OkCancelResult.ok) {
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
|
|
Loading…
Reference in a new issue