mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-25 06:52:35 +01:00
chore: Clean up bootstrap
This commit is contained in:
parent
5c326521fd
commit
65bff2c194
@ -37,7 +37,7 @@ void main() async {
|
|||||||
Zone.current.handleUncaughtError(details.exception, details.stack);
|
Zone.current.handleUncaughtError(details.exception, details.stack);
|
||||||
|
|
||||||
final clients = await ClientManager.getClients();
|
final clients = await ClientManager.getClients();
|
||||||
Logs().level = kReleaseMode ? Level.debug : Level.verbose;
|
Logs().level = kReleaseMode ? Level.warning : Level.verbose;
|
||||||
|
|
||||||
if (PlatformInfos.isMobile) {
|
if (PlatformInfos.isMobile) {
|
||||||
BackgroundPush.clientOnly(clients.first);
|
BackgroundPush.clientOnly(clients.first);
|
||||||
|
@ -182,8 +182,8 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
TextField(
|
TextField(
|
||||||
minLines: 4,
|
minLines: 4,
|
||||||
maxLines: 4,
|
maxLines: 4,
|
||||||
autofocus: true,
|
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
|
readOnly: _recoveryKeyInputLoading,
|
||||||
autofillHints: _recoveryKeyInputLoading
|
autofillHints: _recoveryKeyInputLoading
|
||||||
? null
|
? null
|
||||||
: [AutofillHints.password],
|
: [AutofillHints.password],
|
||||||
@ -196,29 +196,37 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
icon: const Icon(Icons.lock_open_outlined),
|
icon: _recoveryKeyInputLoading
|
||||||
|
? const CircularProgressIndicator.adaptive()
|
||||||
|
: const Icon(Icons.lock_open_outlined),
|
||||||
label: Text(L10n.of(context).unlockChatBackup),
|
label: Text(L10n.of(context).unlockChatBackup),
|
||||||
onPressed: () async {
|
onPressed: _recoveryKeyInputLoading
|
||||||
|
? null
|
||||||
|
: () async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_recoveryKeyInputError = null;
|
_recoveryKeyInputError = null;
|
||||||
_recoveryKeyInputLoading = true;
|
_recoveryKeyInputLoading = true;
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
final key = _recoveryKeyTextEditingController.text;
|
final key =
|
||||||
|
_recoveryKeyTextEditingController.text;
|
||||||
await bootstrap.newSsssKey.unlock(
|
await bootstrap.newSsssKey.unlock(
|
||||||
keyOrPassphrase: key,
|
keyOrPassphrase: key,
|
||||||
);
|
);
|
||||||
|
Logs().d('SSSS unlocked');
|
||||||
await bootstrap.client.encryption.crossSigning
|
await bootstrap.client.encryption.crossSigning
|
||||||
.selfSign(
|
.selfSign(
|
||||||
keyOrPassphrase: key,
|
keyOrPassphrase: key,
|
||||||
);
|
);
|
||||||
|
Logs().d('Successful elfsigned');
|
||||||
await bootstrap.openExistingSsss();
|
await bootstrap.openExistingSsss();
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logs().w('Unable to unlock SSSS', e, s);
|
Logs().w('Unable to unlock SSSS', e, s);
|
||||||
setState(() => _recoveryKeyInputError =
|
setState(() => _recoveryKeyInputError =
|
||||||
L10n.of(context).oopsSomethingWentWrong);
|
L10n.of(context).oopsSomethingWentWrong);
|
||||||
} finally {
|
} finally {
|
||||||
setState(() => _recoveryKeyInputLoading = false);
|
setState(
|
||||||
|
() => _recoveryKeyInputLoading = false);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
@ -239,7 +247,9 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
icon:
|
icon:
|
||||||
const Icon(Icons.transfer_within_a_station_outlined),
|
const Icon(Icons.transfer_within_a_station_outlined),
|
||||||
label: Text(L10n.of(context).transferFromAnotherDevice),
|
label: Text(L10n.of(context).transferFromAnotherDevice),
|
||||||
onPressed: () async {
|
onPressed: _recoveryKeyInputLoading
|
||||||
|
? null
|
||||||
|
: () async {
|
||||||
final req = await showFutureLoadingDialog(
|
final req = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => widget
|
future: () => widget
|
||||||
@ -260,7 +270,9 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
),
|
),
|
||||||
icon: const Icon(Icons.delete_outlined),
|
icon: const Icon(Icons.delete_outlined),
|
||||||
label: Text(L10n.of(context).securityKeyLost),
|
label: Text(L10n.of(context).securityKeyLost),
|
||||||
onPressed: () async {
|
onPressed: _recoveryKeyInputLoading
|
||||||
|
? null
|
||||||
|
: () async {
|
||||||
if (OkCancelResult.ok ==
|
if (OkCancelResult.ok ==
|
||||||
await showOkCancelAlertDialog(
|
await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
|
@ -15,7 +15,6 @@ import 'matrix_sdk_extensions.dart/flutter_matrix_hive_database.dart';
|
|||||||
abstract class ClientManager {
|
abstract class ClientManager {
|
||||||
static const String clientNamespace = 'im.fluffychat.store.clients';
|
static const String clientNamespace = 'im.fluffychat.store.clients';
|
||||||
static Future<List<Client>> getClients() async {
|
static Future<List<Client>> getClients() async {
|
||||||
Logs().level = Level.warning;
|
|
||||||
if (PlatformInfos.isLinux) {
|
if (PlatformInfos.isLinux) {
|
||||||
Hive.init((await getApplicationSupportDirectory()).path);
|
Hive.init((await getApplicationSupportDirectory()).path);
|
||||||
} else {
|
} else {
|
||||||
|
@ -775,7 +775,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "krille/idb"
|
ref: "krille/idb"
|
||||||
resolved-ref: "60b2b6b5fcc45a5bedbe6eafee19258784e1a329"
|
resolved-ref: "74037fb8ae0f4c4e1ac946d7c2057bf6e2da7aaf"
|
||||||
url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git"
|
url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.7.0-nullsafety.6"
|
version: "0.7.0-nullsafety.6"
|
||||||
|
Loading…
Reference in New Issue
Block a user