mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
fix: Set space
This commit is contained in:
parent
97e644b64a
commit
7c3fffc8a6
@ -2618,5 +2618,8 @@
|
|||||||
"time": "Time",
|
"time": "Time",
|
||||||
"messageType": "Message Type",
|
"messageType": "Message Type",
|
||||||
"sender": "Sender",
|
"sender": "Sender",
|
||||||
"openGallery": "Open gallery"
|
"openGallery": "Open gallery",
|
||||||
|
"removeFromSpace": "Remove from space",
|
||||||
|
"removeFromSpaceDescription": "This removes this chat from the current space. It will then still be visible under \"All chats\".",
|
||||||
|
"addToSpaceDescription": "Select a space to add this chat to it."
|
||||||
}
|
}
|
||||||
|
@ -356,6 +356,17 @@ class ChatListController extends State<ChatList> {
|
|||||||
|
|
||||||
Future<void> addOrRemoveToSpace() async {
|
Future<void> addOrRemoveToSpace() async {
|
||||||
if (activeSpaceId != null) {
|
if (activeSpaceId != null) {
|
||||||
|
final consent = await showOkCancelAlertDialog(
|
||||||
|
context: context,
|
||||||
|
title: L10n.of(context).removeFromSpace,
|
||||||
|
message: L10n.of(context).removeFromSpaceDescription,
|
||||||
|
okLabel: L10n.of(context).remove,
|
||||||
|
cancelLabel: L10n.of(context).cancel,
|
||||||
|
isDestructiveAction: true,
|
||||||
|
fullyCapitalizedForMaterial: false,
|
||||||
|
);
|
||||||
|
if (consent != OkCancelResult.ok) return;
|
||||||
|
|
||||||
final space = Matrix.of(context).client.getRoomById(activeSpaceId);
|
final space = Matrix.of(context).client.getRoomById(activeSpaceId);
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -376,6 +387,8 @@ class ChatListController extends State<ChatList> {
|
|||||||
final selectedSpace = await showConfirmationDialog<String>(
|
final selectedSpace = await showConfirmationDialog<String>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).addToSpace,
|
title: L10n.of(context).addToSpace,
|
||||||
|
message: L10n.of(context).addToSpaceDescription,
|
||||||
|
fullyCapitalizedForMaterial: false,
|
||||||
actions: Matrix.of(context)
|
actions: Matrix.of(context)
|
||||||
.client
|
.client
|
||||||
.rooms
|
.rooms
|
||||||
@ -391,11 +404,11 @@ class ChatListController extends State<ChatList> {
|
|||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () async {
|
future: () async {
|
||||||
|
final space = Matrix.of(context).client.getRoomById(selectedSpace);
|
||||||
|
if (space.canSendDefaultStates) {
|
||||||
for (final roomId in selectedRoomIds) {
|
for (final roomId in selectedRoomIds) {
|
||||||
await Matrix.of(context)
|
await space.setSpaceChild(roomId);
|
||||||
.client
|
}
|
||||||
.getRoomById(selectedSpace)
|
|
||||||
.setSpaceChild(roomId);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user