diff --git a/lib/pages/bootstrap/bootstrap_dialog.dart b/lib/pages/bootstrap/bootstrap_dialog.dart index f518fb5d5..e7fa87032 100644 --- a/lib/pages/bootstrap/bootstrap_dialog.dart +++ b/lib/pages/bootstrap/bootstrap_dialog.dart @@ -1,5 +1,3 @@ -import 'dart:async'; - import 'package:flutter/material.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; @@ -119,6 +117,7 @@ class BootstrapDialogState extends State { while (client.prevBatch == null) { await client.onSync.stream.first; } + await client.updateUserDeviceKeys(); _wipe = wipe; titleText = null; _recoveryKeyStored = false; @@ -365,20 +364,12 @@ class BootstrapDialogState extends State { Logs().v( 'Cross signing is already enabled. Try to self-sign', ); - try { - await bootstrap - .client - .encryption! - .crossSigning - .selfSign(recoveryKey: key); - Logs().d('Successful selfsigned'); - } catch (e, s) { - Logs().e( - 'Unable to self sign with recovery key after successfully open existing SSSS', - e, - s, - ); - } + await bootstrap + .client + .encryption! + .crossSigning + .selfSign(recoveryKey: key); + Logs().d('Successful selfsigned'); } } on InvalidPassphraseException catch (e) { setState( @@ -451,26 +442,25 @@ class BootstrapDialogState extends State { 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, + future: () async { + final allCached = + await client.encryption!.keyManager + .isCached() && + await client.encryption!.crossSigning + .isCached(); + if (!allCached) { + await client + .encryption! + .ssss + .onSecretStored + .stream + .first; + } + return; + }, ); - await secretsSub.cancel(); if (!mounted) return; if (!result.isError) _goBackAction(true); }, diff --git a/pubspec.yaml b/pubspec.yaml index 7fe9e0654..bc07a2ba4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,7 +53,7 @@ dependencies: highlight: ^0.7.0 html: ^0.15.4 http: ^1.6.0 - image: ^4.7.1 + image: ^4.7.2 image_picker: ^1.2.1 intl: any just_audio: ^0.10.5