refactor: Use onRoomState stream instead of room.onUpdate to not update on messages but state changes only

pull/1120/head
krille-chan 10 months ago
parent 06b2e6c14f
commit ff54610e5b
No known key found for this signature in database

@ -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…
Cancel
Save