Commit e3107c96 authored by Wilko Manger's avatar Wilko Manger

Sort chats based on last event time

parent d69913fa
Pipeline #314 passed with stages
in 2 minutes and 29 seconds
......@@ -49,7 +49,18 @@ class ChatOverviewBloc {
print(chats.length);
}
_chatsSubj.add(List.of(chats));
chats.sort((a, b) {
if (a.latestEvent != null && b.latestEvent != null) {
return a.latestEvent.time.compareTo(b.latestEvent.time);
} else if (a.latestEvent != null && b.latestEvent == null) {
return 1;
} else if (a.latestEvent == null && b.latestEvent != null) {
return -1;
} else {
return 0;
}
});
_chatsSubj.add(List.of(chats.reversed));
}
Future<void> startSync() async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment