π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][auth] Auto lock fixes
Aman Raj Singh Mourya5f08e44e5835
diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_auto_lock.dart b/auth/lib/ui/settings/lock_screen/lock_screen_auto_lock.dartindex c4315c69e1..c0c1941eb5 100644--- a/auth/lib/ui/settings/lock_screen/lock_screen_auto_lock.dart+++ b/auth/lib/ui/settings/lock_screen/lock_screen_auto_lock.dart@@ -135,7 +135,7 @@ class _AutoLockItemsState extends State<AutoLockItems> {} else if (duration.inSeconds != 0) {return "${duration.inSeconds}s";} else {- return "Disable";+ return "Disabled";}}}diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart b/auth/lib/ui/settings/lock_screen/lock_screen_options.dartindex ff34b5ef85..ba33b5e5e1 100644--- a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart+++ b/auth/lib/ui/settings/lock_screen/lock_screen_options.dart@@ -54,7 +54,7 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {Future<void> _deviceLock() async {await _lockscreenSetting.removePinAndPassword();await _initializeSettings();- await _lockscreenSetting.setAppLockType("Device lock");+ await _lockscreenSetting.setAppLockType(AppLockUpdateType.device);Bus.instance.fire(AppLockUpdateEvent(AppLockUpdateType.device,@@ -78,7 +78,7 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {AppLockUpdateType.pin,),);- _lockscreenSetting.setAppLockType("Pin");+ _lockscreenSetting.setAppLockType(AppLockUpdateType.pin);appLock = isPinEnabled ||isPasswordEnabled ||_configuration.shouldShowSystemLockScreen();@@ -102,7 +102,7 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {AppLockUpdateType.password,),);- _lockscreenSetting.setAppLockType("Password");+ _lockscreenSetting.setAppLockType(AppLockUpdateType.password);appLock = isPinEnabled ||isPasswordEnabled ||_configuration.shouldShowSystemLockScreen();@@ -114,7 +114,9 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {AppLock.of(context)!.setEnabled(!appLock);await _configuration.setSystemLockScreen(!appLock);await _lockscreenSetting.removePinAndPassword();- await _lockscreenSetting.setAppLockType(appLock ? "None" : "Device lock");+ await _lockscreenSetting.setAppLockType(+ appLock ? AppLockUpdateType.none : AppLockUpdateType.device,+ );Bus.instance.fire(AppLockUpdateEvent(appLock ? AppLockUpdateType.none : AppLockUpdateType.device,@@ -147,7 +149,7 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {} else if (duration.inSeconds != 0) {return "in ${duration.inSeconds} second${duration.inSeconds > 1 ? 's' : ''}";} else {- return "Disable";+ return "Disabled";}}diff --git a/auth/lib/utils/lock_screen_settings.dart b/auth/lib/utils/lock_screen_settings.dartindex 8153e6b99f..01c42fd29f 100644--- a/auth/lib/utils/lock_screen_settings.dart+++ b/auth/lib/utils/lock_screen_settings.dart@@ -1,6 +1,7 @@import "dart:convert";import "dart:typed_data";+import "package:ente_auth/events/app_lock_update_event.dart";import "package:ente_crypto_dart/ente_crypto_dart.dart";import "package:flutter_secure_storage/flutter_secure_storage.dart";import "package:shared_preferences/shared_preferences.dart";@@ -34,8 +35,21 @@ class LockScreenSettings {_preferences = await SharedPreferences.getInstance();}- Future<void> setAppLockType(String lockType) async {- await _preferences.setString(appLockType, lockType);+ Future<void> setAppLockType(AppLockUpdateType lockType) async {+ switch (lockType) {+ case AppLockUpdateType.device:+ await _preferences.setString(appLockType, "Device lock");+ break;+ case AppLockUpdateType.pin:+ await _preferences.setString(appLockType, "Pin");+ break;+ case AppLockUpdateType.password:+ await _preferences.setString(appLockType, "Password");+ break;+ default:+ await _preferences.setString(appLockType, "None");+ break;+ }}String getAppLockType() {