|
|
|
@ -62,15 +62,15 @@ extension LocalizedActiveFilter on ActiveFilter {
|
|
|
|
|
String toLocalizedString(BuildContext context) {
|
|
|
|
|
switch (this) {
|
|
|
|
|
case ActiveFilter.allChats:
|
|
|
|
|
return L10n.of(context)!.all;
|
|
|
|
|
return L10n.of(context).all;
|
|
|
|
|
case ActiveFilter.messages:
|
|
|
|
|
return L10n.of(context)!.messages;
|
|
|
|
|
return L10n.of(context).messages;
|
|
|
|
|
case ActiveFilter.unread:
|
|
|
|
|
return L10n.of(context)!.unread;
|
|
|
|
|
return L10n.of(context).unread;
|
|
|
|
|
case ActiveFilter.groups:
|
|
|
|
|
return L10n.of(context)!.groups;
|
|
|
|
|
return L10n.of(context).groups;
|
|
|
|
|
case ActiveFilter.spaces:
|
|
|
|
|
return L10n.of(context)!.spaces;
|
|
|
|
|
return L10n.of(context).spaces;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -128,25 +128,25 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
final inviteAction = await showModalActionSheet<InviteActions>(
|
|
|
|
|
context: context,
|
|
|
|
|
message: room.isDirectChat
|
|
|
|
|
? L10n.of(context)!.invitePrivateChat
|
|
|
|
|
: L10n.of(context)!.inviteGroupChat,
|
|
|
|
|
title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
|
|
|
|
|
? L10n.of(context).invitePrivateChat
|
|
|
|
|
: L10n.of(context).inviteGroupChat,
|
|
|
|
|
title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
|
|
|
|
|
actions: [
|
|
|
|
|
SheetAction(
|
|
|
|
|
key: InviteActions.accept,
|
|
|
|
|
label: L10n.of(context)!.accept,
|
|
|
|
|
label: L10n.of(context).accept,
|
|
|
|
|
icon: Icons.check_outlined,
|
|
|
|
|
isDefaultAction: true,
|
|
|
|
|
),
|
|
|
|
|
SheetAction(
|
|
|
|
|
key: InviteActions.decline,
|
|
|
|
|
label: L10n.of(context)!.decline,
|
|
|
|
|
label: L10n.of(context).decline,
|
|
|
|
|
icon: Icons.close_outlined,
|
|
|
|
|
isDestructiveAction: true,
|
|
|
|
|
),
|
|
|
|
|
SheetAction(
|
|
|
|
|
key: InviteActions.block,
|
|
|
|
|
label: L10n.of(context)!.block,
|
|
|
|
|
label: L10n.of(context).block,
|
|
|
|
|
icon: Icons.block_outlined,
|
|
|
|
|
isDestructiveAction: true,
|
|
|
|
|
),
|
|
|
|
@ -181,7 +181,7 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
if (room.membership == Membership.ban) {
|
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
|
SnackBar(
|
|
|
|
|
content: Text(L10n.of(context)!.youHaveBeenBannedFromThisChat),
|
|
|
|
|
content: Text(L10n.of(context).youHaveBeenBannedFromThisChat),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
@ -221,12 +221,12 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
} else {
|
|
|
|
|
final consent = await showOkCancelAlertDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
title: L10n.of(context)!.forward,
|
|
|
|
|
message: L10n.of(context)!.forwardMessageTo(
|
|
|
|
|
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
|
|
|
|
|
title: L10n.of(context).forward,
|
|
|
|
|
message: L10n.of(context).forwardMessageTo(
|
|
|
|
|
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
|
|
|
|
|
),
|
|
|
|
|
okLabel: L10n.of(context)!.forward,
|
|
|
|
|
cancelLabel: L10n.of(context)!.cancel,
|
|
|
|
|
okLabel: L10n.of(context).forward,
|
|
|
|
|
cancelLabel: L10n.of(context).cancel,
|
|
|
|
|
);
|
|
|
|
|
if (consent == OkCancelResult.cancel) {
|
|
|
|
|
Matrix.of(context).shareContent = null;
|
|
|
|
@ -276,10 +276,10 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
void setServer() async {
|
|
|
|
|
final newServer = await showTextInputDialog(
|
|
|
|
|
useRootNavigator: false,
|
|
|
|
|
title: L10n.of(context)!.changeTheHomeserver,
|
|
|
|
|
title: L10n.of(context).changeTheHomeserver,
|
|
|
|
|
context: context,
|
|
|
|
|
okLabel: L10n.of(context)!.ok,
|
|
|
|
|
cancelLabel: L10n.of(context)!.cancel,
|
|
|
|
|
okLabel: L10n.of(context).ok,
|
|
|
|
|
cancelLabel: L10n.of(context).cancel,
|
|
|
|
|
textFields: [
|
|
|
|
|
DialogTextField(
|
|
|
|
|
prefixText: 'https://',
|
|
|
|
@ -289,7 +289,7 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
autocorrect: false,
|
|
|
|
|
validator: (server) => server?.contains('.') == true
|
|
|
|
|
? null
|
|
|
|
|
: L10n.of(context)!.invalidServerName,
|
|
|
|
|
: L10n.of(context).invalidServerName,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
@ -569,7 +569,7 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final displayname =
|
|
|
|
|
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!));
|
|
|
|
|
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)));
|
|
|
|
|
|
|
|
|
|
final spacesWithPowerLevels = room.client.rooms
|
|
|
|
|
.where(
|
|
|
|
@ -618,8 +618,7 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
L10n.of(context)!
|
|
|
|
|
.goToSpace(space.getLocalizedDisplayname()),
|
|
|
|
|
L10n.of(context).goToSpace(space.getLocalizedDisplayname()),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -638,8 +637,8 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(
|
|
|
|
|
room.pushRuleState == PushRuleState.notify
|
|
|
|
|
? L10n.of(context)!.muteChat
|
|
|
|
|
: L10n.of(context)!.unmuteChat,
|
|
|
|
|
? L10n.of(context).muteChat
|
|
|
|
|
: L10n.of(context).unmuteChat,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
@ -657,8 +656,8 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(
|
|
|
|
|
room.markedUnread
|
|
|
|
|
? L10n.of(context)!.markAsRead
|
|
|
|
|
: L10n.of(context)!.markAsUnread,
|
|
|
|
|
? L10n.of(context).markAsRead
|
|
|
|
|
: L10n.of(context).markAsUnread,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
@ -672,8 +671,8 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(
|
|
|
|
|
room.isFavourite
|
|
|
|
|
? L10n.of(context)!.unpin
|
|
|
|
|
: L10n.of(context)!.pin,
|
|
|
|
|
? L10n.of(context).unpin
|
|
|
|
|
: L10n.of(context).pin,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
@ -686,7 +685,7 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
children: [
|
|
|
|
|
const Icon(Icons.group_work_outlined),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(L10n.of(context)!.addToSpace),
|
|
|
|
|
Text(L10n.of(context).addToSpace),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -697,7 +696,7 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
children: [
|
|
|
|
|
const Icon(Icons.delete_outlined),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(L10n.of(context)!.leave),
|
|
|
|
|
Text(L10n.of(context).leave),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -740,10 +739,10 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
final confirmed = await showOkCancelAlertDialog(
|
|
|
|
|
useRootNavigator: false,
|
|
|
|
|
context: context,
|
|
|
|
|
title: L10n.of(context)!.areYouSure,
|
|
|
|
|
okLabel: L10n.of(context)!.leave,
|
|
|
|
|
cancelLabel: L10n.of(context)!.no,
|
|
|
|
|
message: L10n.of(context)!.archiveRoomDescription,
|
|
|
|
|
title: L10n.of(context).areYouSure,
|
|
|
|
|
okLabel: L10n.of(context).leave,
|
|
|
|
|
cancelLabel: L10n.of(context).no,
|
|
|
|
|
message: L10n.of(context).archiveRoomDescription,
|
|
|
|
|
isDestructiveAction: true,
|
|
|
|
|
);
|
|
|
|
|
if (confirmed == OkCancelResult.cancel) return;
|
|
|
|
@ -755,13 +754,13 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
case ChatContextAction.addToSpace:
|
|
|
|
|
final space = await showConfirmationDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
title: L10n.of(context)!.space,
|
|
|
|
|
title: L10n.of(context).space,
|
|
|
|
|
actions: spacesWithPowerLevels
|
|
|
|
|
.map(
|
|
|
|
|
(space) => AlertDialogAction(
|
|
|
|
|
key: space,
|
|
|
|
|
label: space
|
|
|
|
|
.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
|
|
|
|
|
.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
.toList(),
|
|
|
|
@ -776,7 +775,7 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
|
|
|
|
|
void dismissStatusList() async {
|
|
|
|
|
final result = await showOkCancelAlertDialog(
|
|
|
|
|
title: L10n.of(context)!.hidePresences,
|
|
|
|
|
title: L10n.of(context).hidePresences,
|
|
|
|
|
context: context,
|
|
|
|
|
);
|
|
|
|
|
if (result == OkCancelResult.ok) {
|
|
|
|
@ -792,13 +791,13 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
final input = await showTextInputDialog(
|
|
|
|
|
useRootNavigator: false,
|
|
|
|
|
context: context,
|
|
|
|
|
title: L10n.of(context)!.setStatus,
|
|
|
|
|
message: L10n.of(context)!.leaveEmptyToClearStatus,
|
|
|
|
|
okLabel: L10n.of(context)!.ok,
|
|
|
|
|
cancelLabel: L10n.of(context)!.cancel,
|
|
|
|
|
title: L10n.of(context).setStatus,
|
|
|
|
|
message: L10n.of(context).leaveEmptyToClearStatus,
|
|
|
|
|
okLabel: L10n.of(context).ok,
|
|
|
|
|
cancelLabel: L10n.of(context).cancel,
|
|
|
|
|
textFields: [
|
|
|
|
|
DialogTextField(
|
|
|
|
|
hintText: L10n.of(context)!.statusExampleMessage,
|
|
|
|
|
hintText: L10n.of(context).statusExampleMessage,
|
|
|
|
|
maxLines: 6,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
maxLength: 255,
|
|
|
|
@ -880,22 +879,22 @@ class ChatListController extends State<ChatList>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void editBundlesForAccount(String? userId, String? activeBundle) async {
|
|
|
|
|
final l10n = L10n.of(context)!;
|
|
|
|
|
final l10n = L10n.of(context);
|
|
|
|
|
final client = Matrix.of(context)
|
|
|
|
|
.widget
|
|
|
|
|
.clients[Matrix.of(context).getClientIndexByMatrixId(userId!)];
|
|
|
|
|
final action = await showConfirmationDialog<EditBundleAction>(
|
|
|
|
|
context: context,
|
|
|
|
|
title: L10n.of(context)!.editBundlesForAccount,
|
|
|
|
|
title: L10n.of(context).editBundlesForAccount,
|
|
|
|
|
actions: [
|
|
|
|
|
AlertDialogAction(
|
|
|
|
|
key: EditBundleAction.addToBundle,
|
|
|
|
|
label: L10n.of(context)!.addToBundle,
|
|
|
|
|
label: L10n.of(context).addToBundle,
|
|
|
|
|
),
|
|
|
|
|
if (activeBundle != client.userID)
|
|
|
|
|
AlertDialogAction(
|
|
|
|
|
key: EditBundleAction.removeFromBundle,
|
|
|
|
|
label: L10n.of(context)!.removeFromBundle,
|
|
|
|
|
label: L10n.of(context).removeFromBundle,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|