|
|
|
@ -486,109 +486,6 @@ class _SettingsState extends State<Settings> {
|
|
|
|
|
title: Text(L10n.of(context).appLock),
|
|
|
|
|
onTap: () => _setAppLockAction(context),
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
trailing: Icon(Icons.compare_arrows_outlined),
|
|
|
|
|
title: Text(client.encryption.crossSigning.enabled
|
|
|
|
|
? L10n.of(context).crossSigningEnabled
|
|
|
|
|
: L10n.of(context).crossSigningDisabled),
|
|
|
|
|
subtitle: client.encryption.crossSigning.enabled
|
|
|
|
|
? Text(client.isUnknownSession
|
|
|
|
|
? L10n.of(context).unknownSessionVerify
|
|
|
|
|
: L10n.of(context).sessionVerified +
|
|
|
|
|
', ' +
|
|
|
|
|
(crossSigningCached == null
|
|
|
|
|
? '⌛'
|
|
|
|
|
: (crossSigningCached
|
|
|
|
|
? L10n.of(context).keysCached
|
|
|
|
|
: L10n.of(context).keysMissing)))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (!client.encryption.crossSigning.enabled) {
|
|
|
|
|
return BootstrapDialog(l10n: L10n.of(context))
|
|
|
|
|
.show(context);
|
|
|
|
|
}
|
|
|
|
|
if (client.isUnknownSession) {
|
|
|
|
|
final input = await showTextInputDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
title: L10n.of(context).askSSSSVerify,
|
|
|
|
|
textFields: [
|
|
|
|
|
DialogTextField(
|
|
|
|
|
hintText: L10n.of(context).passphraseOrKey,
|
|
|
|
|
obscureText: true,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
if (input != null) {
|
|
|
|
|
final valid = await showFutureLoadingDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
future: () async {
|
|
|
|
|
// make sure the loading spinner shows before we test the keys
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 100));
|
|
|
|
|
var valid = false;
|
|
|
|
|
try {
|
|
|
|
|
await client.encryption.crossSigning
|
|
|
|
|
.selfSign(recoveryKey: input.single);
|
|
|
|
|
valid = true;
|
|
|
|
|
} catch (_) {
|
|
|
|
|
try {
|
|
|
|
|
await client.encryption.crossSigning
|
|
|
|
|
.selfSign(passphrase: input.single);
|
|
|
|
|
valid = true;
|
|
|
|
|
} catch (_) {
|
|
|
|
|
valid = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return valid;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (valid.result == true) {
|
|
|
|
|
await showOkAlertDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
message: L10n.of(context).verifiedSession,
|
|
|
|
|
);
|
|
|
|
|
setState(() {
|
|
|
|
|
crossSigningCachedFuture = null;
|
|
|
|
|
crossSigningCached = null;
|
|
|
|
|
megolmBackupCachedFuture = null;
|
|
|
|
|
megolmBackupCached = null;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
await showOkAlertDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
message: L10n.of(context).incorrectPassphraseOrKey,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!(await client.encryption.crossSigning.isCached())) {
|
|
|
|
|
await requestSSSSCache(context);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
trailing: Icon(Icons.wb_cloudy_outlined),
|
|
|
|
|
title: Text(client.encryption.keyManager.enabled
|
|
|
|
|
? L10n.of(context).onlineKeyBackupEnabled
|
|
|
|
|
: L10n.of(context).onlineKeyBackupDisabled),
|
|
|
|
|
subtitle: client.encryption.keyManager.enabled
|
|
|
|
|
? Text(megolmBackupCached == null
|
|
|
|
|
? '⌛'
|
|
|
|
|
: (megolmBackupCached
|
|
|
|
|
? L10n.of(context).keysCached
|
|
|
|
|
: L10n.of(context).keysMissing))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (!client.encryption.keyManager.enabled) {
|
|
|
|
|
return BootstrapDialog(l10n: L10n.of(context))
|
|
|
|
|
.show(context);
|
|
|
|
|
}
|
|
|
|
|
if (!(await client.encryption.keyManager.isCached())) {
|
|
|
|
|
await requestSSSSCache(context);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text(L10n.of(context).yourPublicKey),
|
|
|
|
|
onTap: () => showOkAlertDialog(
|
|
|
|
@ -598,6 +495,16 @@ class _SettingsState extends State<Settings> {
|
|
|
|
|
),
|
|
|
|
|
trailing: Icon(Icons.vpn_key_outlined),
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text(L10n.of(context).cachedKeys),
|
|
|
|
|
trailing: Icon(Icons.wb_cloudy_outlined),
|
|
|
|
|
subtitle: Text(
|
|
|
|
|
'${client.encryption.keyManager.enabled ? L10n.of(context).onlineKeyBackupEnabled : L10n.of(context).onlineKeyBackupDisabled}\n${client.encryption.crossSigning.enabled ? L10n.of(context).crossSigningEnabled : L10n.of(context).crossSigningDisabled}'),
|
|
|
|
|
onTap: () => BootstrapDialog(
|
|
|
|
|
l10n: L10n.of(context),
|
|
|
|
|
client: Matrix.of(context).client,
|
|
|
|
|
).show(context),
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
Divider(thickness: 1),
|
|
|
|
|
ListTile(
|
|
|
|
|