mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-06 20:19:30 +01:00
fix: Wait for first sync on bootstrap
This commit is contained in:
parent
a6ab9a2ab0
commit
d6728783a2
@ -156,28 +156,29 @@ class ChatListController extends State<ChatList> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_initReceiveSharingIntent();
|
_initReceiveSharingIntent();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
if (!Matrix.of(context).client.encryptionEnabled) return;
|
(_) => waitForFirstSync().then((_) => checkBootstrap()),
|
||||||
await waitForFirstSync();
|
);
|
||||||
if ((Matrix.of(context).client.database as FlutterMatrixHiveStore)
|
|
||||||
.get(SettingKeys.dontAskForBootstrapKey) ==
|
|
||||||
true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final crossSigning = await crossSigningCachedFuture;
|
|
||||||
final needsBootstrap =
|
|
||||||
Matrix.of(context).client.encryption?.crossSigning?.enabled ==
|
|
||||||
false ||
|
|
||||||
crossSigning == false;
|
|
||||||
final isUnknownSession = Matrix.of(context).client.isUnknownSession;
|
|
||||||
if (needsBootstrap || isUnknownSession) {
|
|
||||||
firstRunBootstrapAction();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkBootstrap() async {
|
||||||
|
if (!Matrix.of(context).client.encryptionEnabled) return;
|
||||||
|
if ((Matrix.of(context).client.database as FlutterMatrixHiveStore)
|
||||||
|
.get(SettingKeys.dontAskForBootstrapKey) ==
|
||||||
|
true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final crossSigning = await crossSigningCachedFuture;
|
||||||
|
final needsBootstrap =
|
||||||
|
Matrix.of(context).client.encryption?.crossSigning?.enabled == false ||
|
||||||
|
crossSigning == false;
|
||||||
|
final isUnknownSession = Matrix.of(context).client.isUnknownSession;
|
||||||
|
if (needsBootstrap || isUnknownSession) {
|
||||||
|
firstRunBootstrapAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_intentDataStreamSubscription?.cancel();
|
_intentDataStreamSubscription?.cancel();
|
||||||
|
Loading…
Reference in New Issue
Block a user