mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-01-22 01:54:20 +01:00
fix: Bootstrap hint
This commit is contained in:
parent
55803d1d3f
commit
1331b10fb1
@ -91,6 +91,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
wordSpacing: 38,
|
wordSpacing: 38,
|
||||||
|
fontFamily: 'monospace',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -129,8 +130,8 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
_recoveryKeyInputError ?? L10n.of(context).pleaseEnterSecurityKey;
|
_recoveryKeyInputError ?? L10n.of(context).pleaseEnterSecurityKey;
|
||||||
body = PlatformInfos.isCupertinoStyle
|
body = PlatformInfos.isCupertinoStyle
|
||||||
? CupertinoTextField(
|
? CupertinoTextField(
|
||||||
minLines: 2,
|
minLines: 1,
|
||||||
maxLines: 2,
|
maxLines: 1,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
autofillHints: _recoveryKeyInputLoading
|
autofillHints: _recoveryKeyInputLoading
|
||||||
@ -139,46 +140,22 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
controller: _recoveryKeyTextEditingController,
|
controller: _recoveryKeyTextEditingController,
|
||||||
)
|
)
|
||||||
: TextField(
|
: TextField(
|
||||||
minLines: 2,
|
minLines: 1,
|
||||||
maxLines: 2,
|
maxLines: 1,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
autofillHints: _recoveryKeyInputLoading
|
autofillHints: _recoveryKeyInputLoading
|
||||||
? null
|
? null
|
||||||
: [AutofillHints.password],
|
: [AutofillHints.password],
|
||||||
controller: _recoveryKeyTextEditingController,
|
controller: _recoveryKeyTextEditingController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: UnderlineInputBorder(),
|
||||||
|
filled: false,
|
||||||
|
hintText: L10n.of(context).securityKey,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
buttons.add(AdaptiveFlatButton(
|
buttons.add(AdaptiveFlatButton(
|
||||||
textColor: Colors.red,
|
label: L10n.of(context).unlockChatBackup,
|
||||||
label: 'Lost security key',
|
|
||||||
onPressed: () async {
|
|
||||||
if (OkCancelResult.ok ==
|
|
||||||
await showOkCancelAlertDialog(
|
|
||||||
context: context,
|
|
||||||
useRootNavigator: false,
|
|
||||||
title: L10n.of(context).securityKeyLost,
|
|
||||||
message: L10n.of(context).wipeChatBackup,
|
|
||||||
okLabel: L10n.of(context).ok,
|
|
||||||
cancelLabel: L10n.of(context).cancel,
|
|
||||||
isDestructiveAction: true,
|
|
||||||
)) {
|
|
||||||
_createBootstrap(true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
));
|
|
||||||
buttons.add(AdaptiveFlatButton(
|
|
||||||
label: L10n.of(context).transferFromAnotherDevice,
|
|
||||||
onPressed: () async {
|
|
||||||
final req = await Matrix.of(context)
|
|
||||||
.client
|
|
||||||
.userDeviceKeys[Matrix.of(context).client.userID]
|
|
||||||
.startVerification();
|
|
||||||
await KeyVerificationDialog(request: req).show(context);
|
|
||||||
Navigator.of(context, rootNavigator: false).pop();
|
|
||||||
},
|
|
||||||
));
|
|
||||||
buttons.add(AdaptiveFlatButton(
|
|
||||||
label: L10n.of(context).next,
|
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_recoveryKeyInputError = null;
|
_recoveryKeyInputError = null;
|
||||||
@ -197,6 +174,35 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
setState(() => _recoveryKeyInputLoading = false);
|
setState(() => _recoveryKeyInputLoading = false);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
buttons.add(AdaptiveFlatButton(
|
||||||
|
label: L10n.of(context).transferFromAnotherDevice,
|
||||||
|
onPressed: () async {
|
||||||
|
final req = await Matrix.of(context)
|
||||||
|
.client
|
||||||
|
.userDeviceKeys[Matrix.of(context).client.userID]
|
||||||
|
.startVerification();
|
||||||
|
await KeyVerificationDialog(request: req).show(context);
|
||||||
|
Navigator.of(context, rootNavigator: false).pop();
|
||||||
|
},
|
||||||
|
));
|
||||||
|
buttons.add(AdaptiveFlatButton(
|
||||||
|
textColor: Colors.red,
|
||||||
|
label: L10n.of(context).securityKeyLost,
|
||||||
|
onPressed: () async {
|
||||||
|
if (OkCancelResult.ok ==
|
||||||
|
await showOkCancelAlertDialog(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: false,
|
||||||
|
title: L10n.of(context).securityKeyLost,
|
||||||
|
message: L10n.of(context).wipeChatBackup,
|
||||||
|
okLabel: L10n.of(context).ok,
|
||||||
|
cancelLabel: L10n.of(context).cancel,
|
||||||
|
isDestructiveAction: true,
|
||||||
|
)) {
|
||||||
|
_createBootstrap(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
));
|
||||||
break;
|
break;
|
||||||
case BootstrapState.askWipeCrossSigning:
|
case BootstrapState.askWipeCrossSigning:
|
||||||
WidgetsBinding.instance.addPostFrameCallback(
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
|
@ -498,7 +498,7 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"pleaseEnterSecurityKey": "Please enter your security key",
|
"pleaseEnterSecurityKey": "Please enter your security key:",
|
||||||
"@pleaseEnterSecurityKey": {
|
"@pleaseEnterSecurityKey": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
@ -2006,6 +2006,11 @@
|
|||||||
"unreadChats": {}
|
"unreadChats": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"unlockChatBackup": "Unlock chat backup",
|
||||||
|
"@unlockChatBackup": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"yourPublicKey": "Your public key",
|
"yourPublicKey": "Your public key",
|
||||||
"@yourPublicKey": {
|
"@yourPublicKey": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -378,6 +378,34 @@ class _SettingsState extends State<Settings> {
|
|||||||
.textTheme
|
.textTheme
|
||||||
.headline6
|
.headline6
|
||||||
.color)),
|
.color)),
|
||||||
|
actions: [
|
||||||
|
FutureBuilder(
|
||||||
|
future: crossSigningCachedFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
final needsBootstrap = Matrix.of(context)
|
||||||
|
.client
|
||||||
|
.encryption
|
||||||
|
.crossSigning
|
||||||
|
.enabled ==
|
||||||
|
false ||
|
||||||
|
snapshot.data == false;
|
||||||
|
final isUnknownSession =
|
||||||
|
Matrix.of(context).client.isUnknownSession;
|
||||||
|
final displayHeader = needsBootstrap || isUnknownSession;
|
||||||
|
if (!displayHeader) return Container();
|
||||||
|
return TextButton.icon(
|
||||||
|
icon: Icon(Icons.cloud, color: Colors.red),
|
||||||
|
label: Text(
|
||||||
|
L10n.of(context).chatBackup,
|
||||||
|
style: TextStyle(color: Colors.red),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
await BootstrapDialog().show(context);
|
||||||
|
AdaptivePageLayout.of(context).popUntilIsFirst();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
],
|
||||||
backgroundColor: Theme.of(context).appBarTheme.color,
|
backgroundColor: Theme.of(context).appBarTheme.color,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
background: ContentBanner(profile?.avatarUrl,
|
background: ContentBanner(profile?.avatarUrl,
|
||||||
|
Loading…
Reference in New Issue
Block a user