2020-04-26 18:15:48 +02:00
|
|
|
import 'package:famedlysdk/famedlysdk.dart';
|
|
|
|
|
|
|
|
extension ClientPresenceExtension on Client {
|
|
|
|
List<Presence> get statusList {
|
2020-05-09 09:30:03 +02:00
|
|
|
final statusList = presences.values.toList().reversed.toList();
|
2020-06-18 13:39:24 +02:00
|
|
|
final directRooms = rooms.where((r) => r.isDirectChat).toList();
|
|
|
|
statusList.removeWhere((p) =>
|
|
|
|
directRooms.indexWhere((r) => r.directChatMatrixID == p.senderId) ==
|
|
|
|
-1);
|
2020-05-09 09:30:03 +02:00
|
|
|
statusList.reversed.toList();
|
2020-04-26 18:15:48 +02:00
|
|
|
return statusList;
|
|
|
|
}
|
2020-06-18 13:39:24 +02:00
|
|
|
|
|
|
|
static final Map<String, Profile> presencesCache = {};
|
|
|
|
|
|
|
|
Future<Profile> requestProfileCached(String senderId) async {
|
|
|
|
presencesCache[senderId] ??= await getProfileFromUserId(senderId);
|
|
|
|
return presencesCache[senderId];
|
|
|
|
}
|
2020-04-26 18:15:48 +02:00
|
|
|
}
|