[Client] Sort rooms on first sync

This commit is contained in:
Christian Pauly 2020-01-04 16:31:14 +00:00
parent 326e76f66c
commit 3b6d4565ae

View file

@ -705,7 +705,9 @@ class Client {
} else { } else {
await handleSync(syncResp); await handleSync(syncResp);
} }
if (this.prevBatch == null) this.onFirstSync.add(true); if (this.prevBatch == null) {
this.onFirstSync.add(true);
}
this.prevBatch = syncResp["next_batch"]; this.prevBatch = syncResp["next_batch"];
if (hash == _syncRequest.hashCode) unawaited(_sync()); if (hash == _syncRequest.hashCode) unawaited(_sync());
} on MatrixException catch (exception) { } on MatrixException catch (exception) {
@ -1010,7 +1012,6 @@ class Client {
.compareTo(a.timeCreated.millisecondsSinceEpoch); .compareTo(a.timeCreated.millisecondsSinceEpoch);
_sortRooms() { _sortRooms() {
if (prevBatch == null) return;
if (_sortLock || rooms.length < 2) return; if (_sortLock || rooms.length < 2) return;
_sortLock = true; _sortLock = true;
rooms?.sort(sortRoomsBy); rooms?.sort(sortRoomsBy);