Merge pull request #1639 from famedly/krille/refactor-first-sync

refactor: Make possible to wait for first sync and await first sync before create megolm session
This commit is contained in:
td 2023-12-13 22:37:21 +05:30 committed by GitHub
commit 53487a5d23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -502,6 +502,7 @@ class KeyManager {
Future<OutboundGroupSession> _createOutboundGroupSession(
String roomId) async {
await clearOrUseOutboundGroupSession(roomId, wipe: true);
await client.firstSyncReceived;
final room = client.getRoomById(roomId);
if (room == null) {
throw Exception(

View File

@ -1586,9 +1586,9 @@ class Client extends MatrixApi {
);
/// Timeout of 0, so that we don't see a spinner for 30 seconds.
final syncFuture = _sync(timeout: Duration.zero);
firstSyncReceived = _sync(timeout: Duration.zero);
if (waitForFirstSync) {
await syncFuture;
await firstSyncReceived;
}
return;
} catch (e, s) {
@ -2341,6 +2341,7 @@ class Client extends MatrixApi {
Future? userDeviceKeysLoading;
Future? roomsLoading;
Future? _accountDataLoading;
Future? firstSyncReceived;
Future? get accountDataLoading => _accountDataLoading;