Fix top list
This commit is contained in:
parent
fb45f53df6
commit
3fa51d74a9
6 changed files with 65 additions and 72 deletions
|
|
@ -1,16 +1,6 @@
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,11 @@ extension PresenceExtension on Presence {
|
|||
if (presence.statusMsg?.isNotEmpty ?? false) {
|
||||
return presence.statusMsg;
|
||||
}
|
||||
return L10n.of(context).lastActiveAgo(
|
||||
DateTime.fromMillisecondsSinceEpoch(presence.lastActiveAgo)
|
||||
.localizedTimeShort(context));
|
||||
if (presence.lastActiveAgo != null) {
|
||||
return L10n.of(context).lastActiveAgo(
|
||||
DateTime.fromMillisecondsSinceEpoch(presence.lastActiveAgo)
|
||||
.localizedTimeShort(context));
|
||||
}
|
||||
return L10n.of(context).lastSeenLongTimeAgo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ extension RoomStatusExtension on Room {
|
|||
|
||||
String getLocalizedStatus(BuildContext context) {
|
||||
if (isDirectChat) {
|
||||
if (directChatPresence != null) {
|
||||
if (directChatPresence != null &&
|
||||
directChatPresence.presence != null &&
|
||||
(directChatPresence.presence.lastActiveAgo != null ||
|
||||
directChatPresence.presence.currentlyActive != null)) {
|
||||
if (directChatPresence.presence.currentlyActive == true) {
|
||||
return L10n.of(context).currentlyActive;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue