Merge pull request #466 from pangeachat/freezing-fix
removed calls to unsafeGetUserFromMemoryOrFallback that was causing s…
This commit is contained in:
commit
3172fd1462
2 changed files with 27 additions and 9 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:fluffychat/pages/invitation_selection/invitation_selection_view.dart';
|
||||
import 'package:fluffychat/pangea/constants/class_default_values.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
|
|
@ -48,16 +49,29 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
|||
);
|
||||
final contacts = client.rooms
|
||||
.where((r) => r.isDirectChat)
|
||||
.map((r) => r.unsafeGetUserFromMemoryOrFallback(r.directChatMatrixID!))
|
||||
// #Pangea
|
||||
// .map((r) => r.unsafeGetUserFromMemoryOrFallback(r.directChatMatrixID!))
|
||||
.map(
|
||||
(r) => r
|
||||
.getParticipants()
|
||||
.firstWhereOrNull((u) => u.id != client.userID),
|
||||
)
|
||||
// Pangea#
|
||||
.toList();
|
||||
// #Pangea
|
||||
contacts.removeWhere((u) => u == null || u.id != BotName.byEnvironment);
|
||||
contacts.sort(
|
||||
(a, b) => a.calcDisplayname().toLowerCase().compareTo(
|
||||
b.calcDisplayname().toLowerCase(),
|
||||
(a, b) => a!.calcDisplayname().toLowerCase().compareTo(
|
||||
b!.calcDisplayname().toLowerCase(),
|
||||
),
|
||||
);
|
||||
//#Pangea
|
||||
return contacts.cast<User>();
|
||||
// contacts.sort(
|
||||
// (a, b) => a.calcDisplayname().toLowerCase().compareTo(
|
||||
// b.calcDisplayname().toLowerCase(),
|
||||
// ),
|
||||
// );
|
||||
// return contacts;
|
||||
return contacts.where((u) => u.id != BotName.byEnvironment).toList();
|
||||
//Pangea#
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,15 +82,19 @@ class GetChatListItemSubtitle {
|
|||
|
||||
final i18n = MatrixLocals(l10n);
|
||||
|
||||
if (text == null) return l10n.emptyChat;
|
||||
if (text == null || event.room.lastEvent == null) {
|
||||
return l10n.emptyChat;
|
||||
}
|
||||
|
||||
if (!event.room.isDirectChat ||
|
||||
event.room.directChatMatrixID != event.room.lastEvent?.senderId) {
|
||||
event.room.directChatMatrixID != event.room.lastEvent!.senderId) {
|
||||
final senderNameOrYou = event.senderId == event.room.client.userID
|
||||
? i18n.you
|
||||
: event.room
|
||||
.unsafeGetUserFromMemoryOrFallback(event.senderId)
|
||||
.calcDisplayname(i18n: i18n);
|
||||
.getParticipants()
|
||||
.firstWhereOrNull((u) => u.id != event!.room.client.userID)
|
||||
?.calcDisplayname(i18n: i18n) ??
|
||||
event.room.lastEvent!.senderId;
|
||||
|
||||
return "$senderNameOrYou: $text";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue