Minor error/structure corrections

pull/1183/head
Kelrap 1 year ago
parent 939a1e6111
commit e4af2f764e

@ -3965,6 +3965,6 @@
"updatePhoneOS": "You may need to update your device's OS version.",
"wordsPerMinute": "Words per minute",
"leaveRoomDescription": "The chat will be moved to the archive. Other users will be able to see that you have left the chat.",
"archiveSpaceDescription": "The space, and any chats within, will be moved to the archive for yourself and other non-admin users.",
"leaveSpaceDescription": "The space, and any chats within, will be moved to the archive. Other users will be able to see that you have left the space."
"archiveSpaceDescription": "All chats within this space will be moved to the archive for yourself and other non-admin users.",
"leaveSpaceDescription": "All chats within this space will be moved to the archive. Other users will be able to see that you have left the space."
}

@ -543,6 +543,7 @@ class ChatDetailsView extends StatelessWidget {
),
onTap: () async {
OkCancelResult confirmed = OkCancelResult.ok;
bool shouldGo = false;
// archiveSpace has its own popup; only show if not space
if (!room.isSpace) {
confirmed = await showOkCancelAlertDialog(
@ -557,13 +558,10 @@ class ChatDetailsView extends StatelessWidget {
}
if (confirmed == OkCancelResult.ok) {
if (room.isSpace) {
final archived = await room.archiveSpace(
shouldGo = await room.archiveSpace(
context,
Matrix.of(context).client,
);
if (archived) {
context.go('/rooms');
}
} else {
final success =
await showFutureLoadingDialog(
@ -572,9 +570,10 @@ class ChatDetailsView extends StatelessWidget {
await room.archive();
},
);
if (success.error == null) {
context.go('/rooms');
shouldGo = (success.error == null);
}
if (shouldGo) {
context.go('/rooms');
}
}
},
@ -597,7 +596,8 @@ class ChatDetailsView extends StatelessWidget {
),
onTap: () async {
OkCancelResult confirmed = OkCancelResult.ok;
// leaveSpace has its own popup; only show if not space
bool shouldGo = false;
// archiveSpace has its own popup; only show if not space
if (!room.isSpace) {
confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
@ -609,18 +609,21 @@ class ChatDetailsView extends StatelessWidget {
);
}
if (confirmed == OkCancelResult.ok) {
if (room.isSpace) {
shouldGo = await room.leaveSpace(
context,
Matrix.of(context).client,
);
} else {
final success = await showFutureLoadingDialog(
context: context,
future: () async {
room.isSpace
? await room.leaveSpace(
context,
Matrix.of(context).client,
)
: await room.leave();
await room.leave();
},
);
if (success.error == null) {
shouldGo = (success.error == null);
}
if (shouldGo) {
context.go('/rooms');
}
}

@ -64,37 +64,6 @@ class ChatListItem extends StatelessWidget {
}
}
// #Pangea
Future<void> leaveAction(BuildContext context) async {
{
if ([Membership.leave, Membership.ban].contains(room.membership)) {
await showFutureLoadingDialog(
context: context,
future: () => room.forget(),
);
return;
}
final confirmed = 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)!.leaveRoomDescription,
);
if (confirmed == OkCancelResult.cancel) return;
if (room.isUnread) {
await room.markUnread(false);
}
await showFutureLoadingDialog(
context: context,
future: () => room.leave(),
);
return;
}
}
// Pangea#
@override
Widget build(BuildContext context) {
final isMuted = room.pushRuleState != PushRuleState.notify;

@ -284,7 +284,6 @@ class _SpaceViewState extends State<SpaceView> {
case SpaceChildContextAction.leave:
// #Pangea
widget.controller.cancelAction();
widget.controller.selectedRoomIds.clear();
if (room == null) return;
widget.controller.toggleSelection(room.id);
room.isSpace
@ -293,6 +292,7 @@ class _SpaceViewState extends State<SpaceView> {
Matrix.of(context).client,
)
: await widget.controller.leaveAction();
widget.controller.selectedRoomIds.clear();
_refresh();
break;
// await showFutureLoadingDialog(

@ -853,7 +853,7 @@ extension PangeaRoom on Room {
return success.error == null;
}
Future<void> leaveSpace(BuildContext context, Client client) async {
Future<bool> leaveSpace(BuildContext context, Client client) async {
final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
@ -863,8 +863,8 @@ extension PangeaRoom on Room {
message: L10n.of(context)!.leaveSpaceDescription,
) ==
OkCancelResult.ok;
if (!confirmed) return;
await showFutureLoadingDialog(
if (!confirmed) return false;
final success = await showFutureLoadingDialog(
context: context,
future: () async {
final List<Room> children = await getChildRooms();
@ -877,6 +877,7 @@ extension PangeaRoom on Room {
await leave();
},
);
return success.error == null;
}
bool canIAddSpaceChild(Room? room) {

Loading…
Cancel
Save