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