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:
commit
53487a5d23
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue