From 6d12168ce5f76575e1f2509416a727803966c65e Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 18 Jan 2021 09:43:53 +0100 Subject: [PATCH] fix: app lock --- lib/views/lock_screen.dart | 1 + lib/views/settings.dart | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/views/lock_screen.dart b/lib/views/lock_screen.dart index 49c41efa..6bff0270 100644 --- a/lib/views/lock_screen.dart +++ b/lib/views/lock_screen.dart @@ -25,6 +25,7 @@ class LockScreen extends StatelessWidget { ); } else { AppLock.of(context).didUnlock(); + AppLock.of(context).disable(); } }); } diff --git a/lib/views/settings.dart b/lib/views/settings.dart index ca8b4ab9..37714cdd 100644 --- a/lib/views/settings.dart +++ b/lib/views/settings.dart @@ -11,6 +11,7 @@ import 'package:fluffychat/app_config.dart'; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/sentry_controller.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_app_lock/flutter_app_lock.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_screen_lock/lock_screen.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; @@ -290,7 +291,12 @@ class _SettingsState extends State { ); if (newLock != null) { await FlutterSecureStorage() - .write(key: SettingKeys.appLockKey, value: newLock.first); + .write(key: SettingKeys.appLockKey, value: newLock.single); + if (newLock.single.isEmpty) { + AppLock.of(context).disable(); + } else { + AppLock.of(context).enable(); + } } }