mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 01:05:17 +00:00
chore: Fetch cached presence
This commit is contained in:
parent
61ade15fa9
commit
ee599c1f52
1 changed files with 9 additions and 6 deletions
|
@ -22,12 +22,15 @@ class PresenceBuilder extends StatelessWidget {
|
|||
if (userId == null) return builder(context, null);
|
||||
|
||||
final client = this.client ?? Matrix.of(context).client;
|
||||
return StreamBuilder(
|
||||
return FutureBuilder<CachedPresence>(
|
||||
future: client.fetchCurrentPresence(userId),
|
||||
builder: (context, cachedPresenceSnapshot) => StreamBuilder(
|
||||
stream: client.onPresenceChanged.stream
|
||||
.where((cachedPresence) => cachedPresence.userid == userId),
|
||||
builder: (context, snapshot) => builder(
|
||||
context,
|
||||
snapshot.data ?? client.presences[userId],
|
||||
snapshot.data ?? cachedPresenceSnapshot.data,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue