Big refactoring
This commit is contained in:
parent
d9d5ab2703
commit
af0696a4ac
11 changed files with 516 additions and 454 deletions
|
|
@ -3,8 +3,18 @@ import 'package:famedlysdk/famedlysdk.dart';
|
|||
extension ClientPresenceExtension on Client {
|
||||
List<Presence> get statusList {
|
||||
final statusList = presences.values.toList().reversed.toList();
|
||||
statusList.removeWhere((p) => p.presence.statusMsg?.isEmpty ?? true);
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue