parent
a1a15af30d
commit
427e06be3e
2 changed files with 399 additions and 194 deletions
|
|
@ -40,4 +40,29 @@ extension JoinRoom on BuildContext {
|
|||
|
||||
return roomId;
|
||||
}
|
||||
|
||||
/// Knocks on a room, success and errors in snackbars.
|
||||
/// Returns the room's ID, or null if knocking failed.
|
||||
Future<String?> knockRoom(
|
||||
JoinRoomRequest request, {
|
||||
required String name,
|
||||
}) async {
|
||||
final container = ProviderScope.containerOf(this);
|
||||
final messenger = ScaffoldMessenger.of(this);
|
||||
|
||||
final roomId = await withProgressSnackbar(
|
||||
"Knocking on $name...",
|
||||
() =>
|
||||
container.read(ClientController.provider.notifier).knockRoom(request),
|
||||
);
|
||||
if (roomId == null) return null;
|
||||
|
||||
messenger.showSnackBar(
|
||||
.new(
|
||||
content: Text("Knocked on $name. Wait for a moderator to let you in."),
|
||||
),
|
||||
);
|
||||
|
||||
return roomId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
import "package:material_ui/material_ui.dart";
|
||||
import "package:nexus/helpers/extensions/show_adaptive_popover.dart";
|
||||
import "package:nexus/models/content/membership.dart";
|
||||
import "package:nexus/widgets/user_bottom_sheet.dart";
|
||||
|
||||
extension ShowUserPopover on BuildContext {
|
||||
void showUserPopover(
|
||||
MembershipContent member,
|
||||
String userId, {
|
||||
String? roomId,
|
||||
}) => showAdaptivePopover(
|
||||
(context) => UserBottomSheet(member, userId, roomId: roomId),
|
||||
);
|
||||
void showUserPopover(String userId, {String? roomId}) =>
|
||||
showAdaptivePopover((context) => UserBottomSheet(userId, roomId: roomId));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue