mirror of
https://github.com/krille-chan/fluffychat
synced 2024-08-10 15:13:44 +00:00
refactor: Use onRoomState stream instead of room.onUpdate to not update on messages but state changes only
This commit is contained in:
parent
06b2e6c14f
commit
ff54610e5b
6 changed files with 12 additions and 6 deletions
|
@ -150,7 +150,8 @@ class ChatView extends StatelessWidget {
|
|||
}
|
||||
},
|
||||
child: StreamBuilder(
|
||||
stream: controller.room.onUpdate.stream
|
||||
stream: controller.room.client.onRoomState.stream
|
||||
.where((update) => update.roomId == controller.room.id)
|
||||
.rateLimit(const Duration(seconds: 1)),
|
||||
builder: (context, snapshot) => FutureBuilder(
|
||||
future: controller.loadTimelineFuture,
|
||||
|
|
|
@ -22,7 +22,8 @@ class ChatAccessSettingsPageView extends StatelessWidget {
|
|||
),
|
||||
body: MaxWidthBody(
|
||||
child: StreamBuilder<Object>(
|
||||
stream: room.onUpdate.stream,
|
||||
stream: room.client.onRoomState.stream
|
||||
.where((update) => update.roomId == controller.room.id),
|
||||
builder: (context, snapshot) {
|
||||
final canonicalAlias = room.canonicalAlias;
|
||||
final altAliases = room
|
||||
|
|
|
@ -36,7 +36,8 @@ class ChatDetailsView extends StatelessWidget {
|
|||
}
|
||||
|
||||
return StreamBuilder(
|
||||
stream: room.onUpdate.stream,
|
||||
stream: room.client.onRoomState.stream
|
||||
.where((update) => update.roomId == room.id),
|
||||
builder: (context, snapshot) {
|
||||
var members = room.getParticipants().toList()
|
||||
..sort((b, a) => a.powerLevel.compareTo(b.powerLevel));
|
||||
|
|
|
@ -82,7 +82,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
StreamBuilder(
|
||||
stream: room.onUpdate.stream,
|
||||
stream: room.client.onRoomState.stream
|
||||
.where((update) => update.roomId == controller.room.id),
|
||||
builder: (context, snapshot) =>
|
||||
FutureBuilder<List<DeviceKeys>>(
|
||||
future: room.getUserDeviceKeys(),
|
||||
|
|
|
@ -64,7 +64,8 @@ class InvitationSelectionView extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
StreamBuilder<Object>(
|
||||
stream: room.onUpdate.stream,
|
||||
stream: room.client.onRoomState.stream
|
||||
.where((update) => update.roomId == room.id),
|
||||
builder: (context, snapshot) {
|
||||
final participants =
|
||||
room.getParticipants().map((user) => user.id).toSet();
|
||||
|
|
|
@ -21,7 +21,8 @@ class MultipleEmotesSettingsView extends StatelessWidget {
|
|||
title: Text(L10n.of(context)!.emotePacks),
|
||||
),
|
||||
body: StreamBuilder(
|
||||
stream: room.onUpdate.stream,
|
||||
stream: room.client.onRoomState.stream
|
||||
.where((update) => update.roomId == room.id),
|
||||
builder: (context, snapshot) {
|
||||
final packStateEvents = room.states['im.ponies.room_emotes'];
|
||||
// we need to manually convert the map using Map.of, otherwise assigning null will throw a type error.
|
||||
|
|
Loading…
Reference in a new issue