forked from Henry-Hiles/nexus
Leave room support, persist last room, fixes
This commit is contained in:
parent
f7c6c3bb6a
commit
7dfd47a404
17 changed files with 312 additions and 136 deletions
|
|
@ -11,6 +11,10 @@ class SpacesController extends AsyncNotifier<IList<Space>> {
|
|||
Future<IList<Space>> build() async {
|
||||
final client = await ref.watch(ClientController.provider.future);
|
||||
|
||||
ref.onDispose(
|
||||
client.onSync.stream.listen((_) => ref.invalidateSelf()).cancel,
|
||||
);
|
||||
|
||||
final topLevel = await Future.wait(
|
||||
client.rooms
|
||||
.where((room) => !room.isDirectChat)
|
||||
|
|
@ -33,12 +37,14 @@ class SpacesController extends AsyncNotifier<IList<Space>> {
|
|||
Space(
|
||||
client: client,
|
||||
title: "Home",
|
||||
id: "home",
|
||||
children: topLevelRooms,
|
||||
icon: Icon(Icons.home),
|
||||
),
|
||||
Space(
|
||||
client: client,
|
||||
title: "Direct Messages",
|
||||
id: "dms",
|
||||
children: await Future.wait(
|
||||
client.rooms
|
||||
.where((room) => room.isDirectChat)
|
||||
|
|
@ -52,6 +58,7 @@ class SpacesController extends AsyncNotifier<IList<Space>> {
|
|||
client: client,
|
||||
title: space.title,
|
||||
avatar: space.avatar,
|
||||
id: space.roomData.id,
|
||||
roomData: space.roomData,
|
||||
children: await Future.wait(
|
||||
space.roomData.spaceChildren
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue