mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-25 23:12:37 +01:00
21 lines
685 B
Dart
21 lines
685 B
Dart
import 'package:famedlysdk/famedlysdk.dart';
|
|
|
|
extension ClientPresenceExtension on Client {
|
|
List<Presence> get statusList {
|
|
final statusList = presences.values.toList().reversed.toList();
|
|
final directRooms = rooms.where((r) => r.isDirectChat).toList();
|
|
statusList.removeWhere((p) =>
|
|
directRooms.indexWhere((r) => r.directChatMatrixID == p.senderId) ==
|
|
-1);
|
|
statusList.reversed.toList();
|
|
return statusList;
|
|
}
|
|
|
|
static final Map<String, Profile> presencesCache = {};
|
|
|
|
Future<Profile> requestProfileCached(String senderId) async {
|
|
presencesCache[senderId] ??= await getProfileFromUserId(senderId);
|
|
return presencesCache[senderId];
|
|
}
|
|
}
|