chore: Adjust join space child UX
This commit is contained in:
parent
6d5ceba885
commit
b4fbe46d43
2 changed files with 22 additions and 17 deletions
|
|
@ -3496,5 +3496,6 @@
|
||||||
"signUpGreeting": "FluffyChat is decentralized! Select a server where you want to create your account and let's go!",
|
"signUpGreeting": "FluffyChat is decentralized! Select a server where you want to create your account and let's go!",
|
||||||
"signInGreeting": "You already have an account in Matrix? Welcome back! Select your homeserver and sign in.",
|
"signInGreeting": "You already have an account in Matrix? Welcome back! Select your homeserver and sign in.",
|
||||||
"appIntro": "With FluffyChat you can chat with your friends. It's a secure decentralized [matrix] messenger! Learn more on https://matrix.org if you like or just sign up.",
|
"appIntro": "With FluffyChat you can chat with your friends. It's a secure decentralized [matrix] messenger! Learn more on https://matrix.org if you like or just sign up.",
|
||||||
"theProcessWasCanceled": "The process was canceled."
|
"theProcessWasCanceled": "The process was canceled.",
|
||||||
|
"join": "Join"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
import 'package:fluffychat/utils/stream_extension.dart';
|
import 'package:fluffychat/utils/stream_extension.dart';
|
||||||
import 'package:fluffychat/utils/string_color.dart';
|
import 'package:fluffychat/utils/string_color.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/public_room_dialog.dart';
|
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
||||||
|
|
@ -131,19 +130,20 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
void _joinChildRoom(SpaceRoomsChunk$2 item) async {
|
void _joinChildRoom(SpaceRoomsChunk$2 item) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final space = client.getRoomById(widget.spaceId);
|
final space = client.getRoomById(widget.spaceId);
|
||||||
|
final via = space?.spaceChildren
|
||||||
final joined = await showAdaptiveDialog<bool>(
|
.firstWhereOrNull((child) => child.roomId == item.roomId)
|
||||||
|
?.via;
|
||||||
|
final roomResult = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => PublicRoomDialog(
|
future: () async {
|
||||||
chunk: item,
|
final waitForRoom = client.waitForRoomInSync(item.roomId, join: true);
|
||||||
via: space?.spaceChildren
|
await client.joinRoom(item.roomId, via: via);
|
||||||
.firstWhereOrNull((child) => child.roomId == item.roomId)
|
await waitForRoom;
|
||||||
?.via,
|
return client.getRoomById(item.roomId)!;
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
if (mounted && joined == true) {
|
final room = roomResult.result;
|
||||||
setState(() {});
|
if (room != null) widget.onChatTab(room);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSpaceAction(SpaceActions action) async {
|
void _onSpaceAction(SpaceActions action) async {
|
||||||
|
|
@ -597,12 +597,13 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
visualDensity: const VisualDensity(
|
visualDensity: const VisualDensity(
|
||||||
vertical: -0.5,
|
vertical: -0.5,
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: EdgeInsets.only(
|
||||||
horizontal: 8,
|
left: 8,
|
||||||
|
right: joinedRoom == null ? 0 : 8,
|
||||||
),
|
),
|
||||||
onTap: joinedRoom != null
|
onTap: joinedRoom != null
|
||||||
? () => widget.onChatTab(joinedRoom!)
|
? () => widget.onChatTab(joinedRoom!)
|
||||||
: () => _joinChildRoom(item),
|
: null,
|
||||||
onLongPress: isAdmin
|
onLongPress: isAdmin
|
||||||
? () => _showSpaceChildEditMenu(
|
? () => _showSpaceChildEditMenu(
|
||||||
context,
|
context,
|
||||||
|
|
@ -675,7 +676,10 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
if (joinedRoom != null)
|
if (joinedRoom != null)
|
||||||
UnreadBubble(room: joinedRoom)
|
UnreadBubble(room: joinedRoom)
|
||||||
else
|
else
|
||||||
const Icon(Icons.chevron_right_outlined),
|
TextButton(
|
||||||
|
onPressed: () => _joinChildRoom(item),
|
||||||
|
child: Text(L10n.of(context).join),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue