From bcd2a035d1364a0fef803e38f427f07474522f62 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 6 Mar 2021 10:03:01 +0100 Subject: [PATCH] fix: Bootstrap in columnview --- lib/components/dialogs/bootstrap_dialog.dart | 12 +++++------- lib/views/settings.dart | 13 ++++++++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/components/dialogs/bootstrap_dialog.dart b/lib/components/dialogs/bootstrap_dialog.dart index 89faca99..c9448906 100644 --- a/lib/components/dialogs/bootstrap_dialog.dart +++ b/lib/components/dialogs/bootstrap_dialog.dart @@ -3,7 +3,6 @@ import 'package:famedlysdk/encryption.dart'; import 'package:famedlysdk/encryption/utils/bootstrap.dart'; import 'package:famedlysdk/famedlysdk.dart'; import 'package:fluffychat/components/dialogs/adaptive_flat_button.dart'; -import 'package:fluffychat/components/matrix.dart'; import 'package:flutter/services.dart'; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:flutter/cupertino.dart'; @@ -14,9 +13,11 @@ import 'key_verification_dialog.dart'; class BootstrapDialog extends StatefulWidget { final bool wipe; + final Client client; const BootstrapDialog({ Key key, this.wipe = false, + @required this.client, }) : super(key: key); Future show(BuildContext context) => PlatformInfos.isCupertinoStyle @@ -56,9 +57,7 @@ class _BootstrapDialogState extends State { _wipe = wipe; titleText = null; _recoveryKeyStored = false; - bootstrap = Matrix.of(context) - .client - .encryption + bootstrap = widget.client.encryption .bootstrap(onUpdate: () => setState(() => null)); }); } @@ -177,9 +176,8 @@ class _BootstrapDialogState extends State { buttons.add(AdaptiveFlatButton( label: L10n.of(context).transferFromAnotherDevice, onPressed: () async { - final req = await Matrix.of(context) - .client - .userDeviceKeys[Matrix.of(context).client.userID] + final req = await widget + .client.userDeviceKeys[widget.client.userID] .startVerification(); await KeyVerificationDialog(request: req).show(context); Navigator.of(context, rootNavigator: false).pop(); diff --git a/lib/views/settings.dart b/lib/views/settings.dart index 29c78754..61665330 100644 --- a/lib/views/settings.dart +++ b/lib/views/settings.dart @@ -397,7 +397,9 @@ class _SettingsState extends State { style: TextStyle(color: Colors.red), ), onPressed: () async { - await BootstrapDialog().show(context); + await BootstrapDialog( + client: Matrix.of(context).client, + ).show(context); AdaptivePageLayout.of(context).popUntilIsFirst(); }, ); @@ -579,11 +581,16 @@ class _SettingsState extends State { cancelLabel: L10n.of(context).cancel, useRootNavigator: false, )) { - await BootstrapDialog(wipe: true).show(context); + await BootstrapDialog( + client: Matrix.of(context).client, + wipe: true, + ).show(context); } return; } - await BootstrapDialog().show(context); + await BootstrapDialog( + client: Matrix.of(context).client, + ).show(context); }, ), },