π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Used better names
Aman Raj Singh Mourya8117a2929cd5
diff --git a/mobile/lib/services/local_authentication_service.dart b/mobile/lib/services/local_authentication_service.dartindex 6167fca67f..fecca7ac70 100644--- a/mobile/lib/services/local_authentication_service.dart+++ b/mobile/lib/services/local_authentication_service.dart@@ -43,7 +43,7 @@ class LocalAuthenticationService {BuildContext context,String? savedPin,String? savedPassword, {- bool isOnOpeningApp = false,+ bool isAuthenticatingOnAppLaunch = false,bool isAuthenticatingForInAppChange = false,}) async {if (savedPassword != null) {@@ -51,9 +51,9 @@ class LocalAuthenticationService {MaterialPageRoute(builder: (BuildContext context) {return LockScreenPassword(- isAuthenticating: true,+ isChangingLockScreenSettings: true,isAuthenticatingForInAppChange: isAuthenticatingForInAppChange,- isOnOpeningApp: isOnOpeningApp,+ isAuthenticatingOnAppLaunch: isAuthenticatingOnAppLaunch,authPass: savedPassword,);},@@ -68,9 +68,9 @@ class LocalAuthenticationService {MaterialPageRoute(builder: (BuildContext context) {return LockScreenPin(- isAuthenticating: true,+ isChangingLockScreenSettings: true,isAuthenticatingForInAppChange: isAuthenticatingForInAppChange,- isOnOpeningApp: isOnOpeningApp,+ isAuthenticatingOnAppLaunch: isAuthenticatingOnAppLaunch,authPin: savedPin,);},diff --git a/mobile/lib/ui/settings/lock_screen/lock_screen_password.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_password.dartindex 4cf7f965e0..066aeb713c 100644--- a/mobile/lib/ui/settings/lock_screen/lock_screen_password.dart+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_password.dart@@ -16,15 +16,23 @@ import "package:photos/utils/lock_screen_settings.dart";class LockScreenPassword extends StatefulWidget {const LockScreenPassword({super.key,- this.isAuthenticating = false,- this.isOnOpeningApp = false,+ this.isChangingLockScreenSettings = false,+ this.isAuthenticatingOnAppLaunch = false,this.isAuthenticatingForInAppChange = false,this.authPass,});- //Is false when setting a new password- final bool isAuthenticating;- final bool isOnOpeningApp;+ /// [isChangingLockScreenSettings] Authentication required for changing lock screen settings.+ /// Set to true when the app requires the user to authenticate before allowing+ /// changes to the lock screen settings.+ final bool isChangingLockScreenSettings;++ /// [isAuthenticatingOnAppLaunch] Authentication required on app launch.+ /// Set to true when the app requires the user to authenticate immediately upon opening.+ final bool isAuthenticatingOnAppLaunch;++ /// [isAuthenticatingForInAppChange] Authentication required for in-app changes (e.g., email, password).+ /// Set to true when the app requires the to authenticate for sensitive actions like email, password changes.final bool isAuthenticatingForInAppChange;final String? authPass;@override@@ -157,7 +165,7 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {),),Text(- widget.isAuthenticating+ widget.isChangingLockScreenSettings? S.of(context).enterPassword: S.of(context).setNewPassword,textAlign: TextAlign.center,@@ -203,7 +211,8 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {if (widget.authPass == base64Encode(hash)) {await _lockscreenSetting.setInvalidAttemptCount(0);- widget.isOnOpeningApp || widget.isAuthenticatingForInAppChange+ widget.isAuthenticatingOnAppLaunch ||+ widget.isAuthenticatingForInAppChange? Navigator.of(context).pop(true): Navigator.of(context).pushReplacement(MaterialPageRoute(@@ -212,7 +221,7 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {);return true;} else {- if (widget.isOnOpeningApp) {+ if (widget.isAuthenticatingOnAppLaunch) {invalidAttemptsCount++;if (invalidAttemptsCount > 4) {await _lockscreenSetting.setInvalidAttemptCount(invalidAttemptsCount);@@ -226,7 +235,7 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {}Future<void> _confirmPassword() async {- if (widget.isAuthenticating) {+ if (widget.isChangingLockScreenSettings) {await _confirmPasswordAuth(_passwordController.text);return;} else {diff --git a/mobile/lib/ui/settings/lock_screen/lock_screen_pin.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_pin.dartindex bc0eb91cde..166f137ab9 100644--- a/mobile/lib/ui/settings/lock_screen/lock_screen_pin.dart+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_pin.dart@@ -18,15 +18,23 @@ import 'package:pinput/pinput.dart';class LockScreenPin extends StatefulWidget {const LockScreenPin({super.key,- this.isAuthenticating = false,- this.isOnOpeningApp = false,+ this.isChangingLockScreenSettings = false,+ this.isAuthenticatingOnAppLaunch = false,this.isAuthenticatingForInAppChange = false,this.authPin,});- //Is false when setting a new password- final bool isAuthenticating;- final bool isOnOpeningApp;+ /// [isChangingLockScreenSettings] Authentication required for changing lock screen settings.+ /// Set to true when the app requires the user to authenticate before allowing+ /// changes to the lock screen settings.+ final bool isChangingLockScreenSettings;++ /// [isAuthenticatingOnAppLaunch] Authentication required on app launch.+ /// Set to true when the app requires the user to authenticate immediately upon opening.+ final bool isAuthenticatingOnAppLaunch;++ /// [isAuthenticatingForInAppChange] Authentication required for in-app changes (e.g., email, password).+ /// Set to true when the app requires the to authenticate for sensitive actions like email, password changes.final bool isAuthenticatingForInAppChange;final String? authPin;@override@@ -64,7 +72,8 @@ class _LockScreenPinState extends State<LockScreenPin> {if (widget.authPin == base64Encode(hash)) {invalidAttemptsCount = 0;await _lockscreenSetting.setInvalidAttemptCount(0);- widget.isOnOpeningApp || widget.isAuthenticatingForInAppChange+ widget.isAuthenticatingOnAppLaunch ||+ widget.isAuthenticatingForInAppChange? Navigator.of(context).pop(true): Navigator.of(context).pushReplacement(MaterialPageRoute(@@ -83,7 +92,7 @@ class _LockScreenPinState extends State<LockScreenPin> {isPinValid = false;});- if (widget.isOnOpeningApp) {+ if (widget.isAuthenticatingOnAppLaunch) {invalidAttemptsCount++;if (invalidAttemptsCount > 4) {await _lockscreenSetting.setInvalidAttemptCount(invalidAttemptsCount);@@ -95,7 +104,7 @@ class _LockScreenPinState extends State<LockScreenPin> {}Future<void> _confirmPin(String code) async {- if (widget.isAuthenticating) {+ if (widget.isChangingLockScreenSettings) {await confirmPinAuth(code);return;} else {@@ -222,7 +231,7 @@ class _LockScreenPinState extends State<LockScreenPin> {),),Text(- widget.isAuthenticating+ widget.isChangingLockScreenSettings? S.of(context).enterPin: S.of(context).setNewPin,style: textTheme.bodyBold,diff --git a/mobile/lib/utils/auth_util.dart b/mobile/lib/utils/auth_util.dartindex 6db836594c..f25aff58b7 100644--- a/mobile/lib/utils/auth_util.dart+++ b/mobile/lib/utils/auth_util.dart@@ -24,7 +24,7 @@ Future<bool> requestAuthentication(context,savedPin,savedPassword,- isOnOpeningApp: isOpeningApp,+ isAuthenticatingOnAppLaunch: isOpeningApp,isAuthenticatingForInAppChange: isAuthenticatingForInAppChange,);} else {