mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 06:55:12 +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);
|
if (userId == null) return builder(context, null);
|
||||||
|
|
||||||
final client = this.client ?? Matrix.of(context).client;
|
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
|
stream: client.onPresenceChanged.stream
|
||||||
.where((cachedPresence) => cachedPresence.userid == userId),
|
.where((cachedPresence) => cachedPresence.userid == userId),
|
||||||
builder: (context, snapshot) => builder(
|
builder: (context, snapshot) => builder(
|
||||||
context,
|
context,
|
||||||
snapshot.data ?? client.presences[userId],
|
snapshot.data ?? cachedPresenceSnapshot.data,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue