chore: Wait for secrets after bootstrap verification

This commit is contained in:
Christian Kußowski 2025-11-23 09:36:28 +01:00
commit 02b0fcb8a6
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
2 changed files with 37 additions and 8 deletions

View file

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
@ -419,8 +421,33 @@ class BootstrapDialogState extends State<BootstrapDialog> {
},
);
if (req.error != null) return;
await KeyVerificationDialog(request: req.result!)
.show(context);
final success = await KeyVerificationDialog(
request: req.result!,
).show(context);
if (success != true) return;
if (!mounted) return;
final waitForSecret = Completer();
final secretsSub = client
.encryption!.ssss.onSecretStored.stream
.listen((
event,
) async {
if (await client.encryption!.keyManager
.isCached() &&
await client.encryption!.crossSigning
.isCached()) {
waitForSecret.complete();
}
});
final result = await showFutureLoadingDialog(
context: context,
future: () => waitForSecret.future,
);
await secretsSub.cancel();
if (!mounted) return;
if (!result.isError) _goBackAction(true);
},
),
const SizedBox(height: 16),