π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][auth] Independent applock implemented
Aman Raj Singh Mourya1323525cd872
diff --git a/auth/lib/services/local_authentication_service.dart b/auth/lib/services/local_authentication_service.dartindex 9072d02184..a5a2042338 100644--- a/auth/lib/services/local_authentication_service.dart+++ b/auth/lib/services/local_authentication_service.dart@@ -6,6 +6,7 @@ import 'package:ente_auth/ui/settings/lock_screen/lock_screen_pin.dart';import 'package:ente_auth/ui/tools/app_lock.dart';import 'package:ente_auth/utils/auth_util.dart';import 'package:ente_auth/utils/dialog_util.dart';+import 'package:ente_auth/utils/lock_screen_settings.dart';import 'package:ente_auth/utils/toast_util.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';@@ -23,7 +24,8 @@ class LocalAuthenticationService {BuildContext context,String infoMessage,) async {- if (await isLocalAuthSupportedOnDevice()) {+ if (await isLocalAuthSupportedOnDevice() ||+ LockScreenSettings.instance.getIsAppLockSet()) {AppLock.of(context)!.setEnabled(false);final result = await requestAuthentication(context,diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart b/auth/lib/ui/settings/lock_screen/lock_screen_options.dartindex df211a9cec..3196ff895d 100644--- a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart+++ b/auth/lib/ui/settings/lock_screen/lock_screen_options.dart@@ -84,13 +84,15 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {},),);- await _lockscreenSetting.setAppLockEnabled(result);- await _initializeSettings();- setState(() {- if (result) {++ if (result) {+ await _configuration.setSystemLockScreen(false);+ await _lockscreenSetting.setAppLockEnabled(true);+ setState(() {appLock = _lockscreenSetting.getIsAppLockSet();- }- });+ });+ }+ await _initializeSettings();}Future<void> _passwordLock() async {@@ -101,14 +103,13 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {},),);-- await _lockscreenSetting.setAppLockEnabled(result);- await _initializeSettings();- setState(() {- if (result) {+ if (result) {+ await _configuration.setSystemLockScreen(false);+ setState(() {appLock = _lockscreenSetting.getIsAppLockSet();- }- });+ });+ }+ await _initializeSettings();}Future<void> _onToggleSwitch() async {diff --git a/auth/lib/utils/lock_screen_settings.dart b/auth/lib/utils/lock_screen_settings.dartindex bd60c62445..100bd3434a 100644--- a/auth/lib/utils/lock_screen_settings.dart+++ b/auth/lib/utils/lock_screen_settings.dart@@ -46,18 +46,20 @@ class LockScreenSettings {}Future<void> setHasMigratedLockScreenChanges() async {- if (_preferences.getBool(keyHasMigratedLockScreenChanges) == null ||- getIsAppLockSet() == false) {- await _preferences.setBool(keyHasMigratedLockScreenChanges, true);-- final bool passwordEnabled = await isPasswordSet();- final bool pinEnabled = await isPinSet();- final bool systemLockEnabled =- Configuration.instance.shouldShowSystemLockScreen();- if (passwordEnabled || pinEnabled || systemLockEnabled) {- await setAppLockEnabled(true);- }+ if (_preferences.getBool(keyHasMigratedLockScreenChanges) != null) {+ return;}++ final bool passwordEnabled = await isPasswordSet();+ final bool pinEnabled = await isPinSet();+ final bool systemLockEnabled =+ Configuration.instance.shouldShowSystemLockScreen();++ if (passwordEnabled || pinEnabled || systemLockEnabled) {+ await setAppLockEnabled(true);+ }++ await _preferences.setBool(keyHasMigratedLockScreenChanges, true);}Future<void> setHideAppContent(bool hideContent) async {