feat: Speed up app start

This commit is contained in:
Krille Fear 2021-11-09 13:06:41 +01:00
parent 3fdf2bf80d
commit b903bf8472
4 changed files with 16 additions and 5 deletions

View File

@ -386,6 +386,8 @@ class ChatListController extends State<ChatList> {
Future<void> waitForFirstSync() async {
final client = Matrix.of(context).client;
await client.roomsLoading;
await client.accountDataLoading;
if (client.prevBatch?.isEmpty ?? true) {
await client.onFirstSync.stream.first;
}

View File

@ -37,7 +37,10 @@ abstract class ClientManager {
}
final clients = clientNames.map(createClient).toList();
await Future.wait(clients.map((client) => client
.init(waitForFirstSync: false)
.init(
waitForFirstSync: false,
waitUntilFullLoaded: false,
)
.catchError((e, s) => Logs().e('Unable to initialize client', e, s))));
if (clients.length > 1 && clients.any((c) => !c.isLogged())) {
final loggedOutClients = clients.where((c) => !c.isLogged()).toList();

View File

@ -752,9 +752,11 @@ packages:
matrix:
dependency: "direct main"
description:
name: matrix
url: "https://pub.dartlang.org"
source: hosted
path: "."
ref: "krille/improve-start-up-time"
resolved-ref: "6585cf195f414175c72693f720569d9ce68319d2"
url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git"
source: git
version: "0.7.0-nullsafety.3"
matrix_api_lite:
dependency: "direct overridden"

View File

@ -112,5 +112,9 @@ dependency_overrides:
hosted:
name: geolocator_android
url: https://hanntech-gmbh.gitlab.io/free2pass/flutter-geolocator-floss
matrix:
git:
url: https://gitlab.com/famedly/company/frontend/famedlysdk.git
ref: krille/improve-start-up-time
matrix_api_lite: ^0.5.0
provider: 5.0.0
provider: 5.0.0