fix: Show bootstrap dialog in the appropriate places
This commit is contained in:
parent
ba3cf3a91f
commit
7a08592a1e
3 changed files with 33 additions and 42 deletions
|
|
@ -92,25 +92,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
|||
}
|
||||
}
|
||||
|
||||
void bootstrapSettingsAction() async {
|
||||
if (await Matrix.of(context).client.encryption.keyManager.isCached()) {
|
||||
if (OkCancelResult.ok ==
|
||||
await showOkCancelAlertDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
title: L10n.of(context).keysCached,
|
||||
message: L10n.of(context).wipeChatBackup,
|
||||
isDestructiveAction: true,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
)) {
|
||||
await BootstrapDialog(
|
||||
client: Matrix.of(context).client,
|
||||
wipe: true,
|
||||
).show(context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
void showBootstrapDialog(BuildContext context) async {
|
||||
await BootstrapDialog(
|
||||
client: Matrix.of(context).client,
|
||||
).show(context);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,10 @@ class SettingsSecurityView extends StatelessWidget {
|
|||
Matrix.of(context).client.encryption.crossSigning.enabled
|
||||
? const Icon(Icons.check, color: Colors.green)
|
||||
: const Icon(Icons.error, color: Colors.red),
|
||||
onTap:
|
||||
Matrix.of(context).client.encryption.crossSigning.enabled
|
||||
? null
|
||||
: () => controller.showBootstrapDialog(context),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context).onlineKeyBackupEnabled),
|
||||
|
|
@ -74,24 +78,40 @@ class SettingsSecurityView extends StatelessWidget {
|
|||
Matrix.of(context).client.encryption.keyManager.enabled
|
||||
? const Icon(Icons.check, color: Colors.green)
|
||||
: const Icon(Icons.error, color: Colors.red),
|
||||
onTap: Matrix.of(context).client.encryption.keyManager.enabled
|
||||
? null
|
||||
: () => controller.showBootstrapDialog(context),
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Session verified'),
|
||||
trailing: !Matrix.of(context).client.isUnknownSession
|
||||
? const Icon(Icons.check, color: Colors.green)
|
||||
: const Icon(Icons.error, color: Colors.red),
|
||||
onTap: !Matrix.of(context).client.isUnknownSession
|
||||
? null
|
||||
: () => controller.showBootstrapDialog(context),
|
||||
),
|
||||
FutureBuilder(
|
||||
future: Matrix.of(context)
|
||||
.client
|
||||
.encryption
|
||||
.keyManager
|
||||
.isCached(),
|
||||
future: () async {
|
||||
return (await Matrix.of(context)
|
||||
.client
|
||||
.encryption
|
||||
.keyManager
|
||||
.isCached()) &&
|
||||
(await Matrix.of(context)
|
||||
.client
|
||||
.encryption
|
||||
.crossSigning
|
||||
.isCached());
|
||||
}(),
|
||||
builder: (context, snapshot) => ListTile(
|
||||
title: Text(L10n.of(context).keysCached),
|
||||
trailing: snapshot.data == true
|
||||
? const Icon(Icons.check, color: Colors.green)
|
||||
: const Icon(Icons.error, color: Colors.red),
|
||||
onTap: snapshot.data == true
|
||||
? null
|
||||
: () => controller.showBootstrapDialog(context),
|
||||
),
|
||||
),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue