Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Use consistent names for all lock screen related classes and file names

ashilkn03ded09cb4d1
diff --git a/mobile/lib/core/configuration.dart b/mobile/lib/core/configuration.dart
index 1bb28050aa..f9ccd55868 100644
--- a/mobile/lib/core/configuration.dart
+++ b/mobile/lib/core/configuration.dart
@@ -34,7 +34,7 @@ import 'package:photos/services/search_service.dart';
import 'package:photos/services/sync_service.dart';
import 'package:photos/utils/crypto_util.dart';
import 'package:photos/utils/file_uploader.dart';
-import "package:photos/utils/lockscreen_setting.dart";
+import "package:photos/utils/lock_screen_settings.dart";
import 'package:photos/utils/validator_util.dart';
import "package:photos/utils/wakelock_util.dart";
import 'package:shared_preferences/shared_preferences.dart';
@@ -620,8 +620,8 @@ class Configuration {
}
Future<bool> shouldShowLockScreen() async {
- final bool isPin = await LockscreenSetting.instance.isPinSet();
- final bool isPass = await LockscreenSetting.instance.isPasswordSet();
+ final bool isPin = await LockScreenSettings.instance.isPinSet();
+ final bool isPass = await LockScreenSettings.instance.isPasswordSet();
return isPin || isPass || shouldShowSystemLockScreen();
}
diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart
index e892de0137..7775b00aaa 100644
--- a/mobile/lib/main.dart
+++ b/mobile/lib/main.dart
@@ -53,7 +53,7 @@ import 'package:photos/utils/crypto_util.dart';
import "package:photos/utils/email_util.dart";
import 'package:photos/utils/file_uploader.dart';
import 'package:photos/utils/local_settings.dart';
-import "package:photos/utils/lockscreen_setting.dart";
+import "package:photos/utils/lock_screen_settings.dart";
import 'package:shared_preferences/shared_preferences.dart';
final _logger = Logger("main");
@@ -210,7 +210,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
CryptoUtil.init();
_logger.info("Lockscreen init");
- LockscreenSetting.instance.init(preferences);
+ LockScreenSettings.instance.init(preferences);
_logger.info("Configuration init");
await Configuration.instance.init();
diff --git a/mobile/lib/services/local_authentication_service.dart b/mobile/lib/services/local_authentication_service.dart
index 73cc0e3701..4f2c6916bc 100644
--- a/mobile/lib/services/local_authentication_service.dart
+++ b/mobile/lib/services/local_authentication_service.dart
@@ -3,8 +3,8 @@ import "dart:async";
import 'package:flutter/material.dart';
import 'package:local_auth/local_auth.dart';
import 'package:photos/core/configuration.dart';
-import "package:photos/ui/settings/lockscreen/lockscreen_password.dart";
-import "package:photos/ui/settings/lockscreen/lockscreen_pin.dart";
+import "package:photos/ui/settings/lock_screen/lock_screen_password.dart";
+import "package:photos/ui/settings/lock_screen/lock_screen_pin.dart";
import 'package:photos/ui/tools/app_lock.dart';
import 'package:photos/utils/auth_util.dart';
import 'package:photos/utils/dialog_util.dart';
diff --git a/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_password.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart
similarity index 97%
rename from mobile/lib/ui/settings/lockscreen/lockscreen_confirm_password.dart
rename to mobile/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart
index 1ab2861c57..22fe75b0a4 100644
--- a/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_password.dart
+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart
@@ -5,7 +5,7 @@ import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/common/dynamic_fab.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
import "package:photos/ui/components/text_input_widget.dart";
-import "package:photos/utils/lockscreen_setting.dart";
+import "package:photos/utils/lock_screen_settings.dart";
class LockScreenConfirmPassword extends StatefulWidget {
const LockScreenConfirmPassword({
@@ -23,7 +23,7 @@ class _LockScreenConfirmPasswordState extends State<LockScreenConfirmPassword> {
/// _confirmPasswordController is disposed by the [TextInputWidget]
final _confirmPasswordController = TextEditingController(text: null);
- final LockscreenSetting _lockscreenSetting = LockscreenSetting.instance;
+ final LockScreenSettings _lockscreenSetting = LockScreenSettings.instance;
final _focusNode = FocusNode();
final _isFormValid = ValueNotifier<bool>(false);
final _submitNotifier = ValueNotifier(false);
diff --git a/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_pin.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_confirm_pin.dart
similarity index 98%
rename from mobile/lib/ui/settings/lockscreen/lockscreen_confirm_pin.dart
rename to mobile/lib/ui/settings/lock_screen/lock_screen_confirm_pin.dart
index fae5264c5f..c10a33323c 100644
--- a/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_pin.dart
+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_confirm_pin.dart
@@ -4,7 +4,7 @@ import "package:photos/theme/colors.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/theme/text_style.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
-import "package:photos/utils/lockscreen_setting.dart";
+import "package:photos/utils/lock_screen_settings.dart";
import "package:pinput/pinput.dart";
class LockScreenConfirmPin extends StatefulWidget {
@@ -17,7 +17,7 @@ class LockScreenConfirmPin extends StatefulWidget {
class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
final _confirmPinController = TextEditingController(text: null);
- final LockscreenSetting _lockscreenSetting = LockscreenSetting.instance;
+ final LockScreenSettings _lockscreenSetting = LockScreenSettings.instance;
final _pinPutDecoration = PinTheme(
height: 48,
width: 48,
diff --git a/mobile/lib/ui/settings/lockscreen/lock_screen_option.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
similarity index 94%
rename from mobile/lib/ui/settings/lockscreen/lock_screen_option.dart
rename to mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
index 57e5529297..a274944996 100644
--- a/mobile/lib/ui/settings/lockscreen/lock_screen_option.dart
+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
@@ -7,21 +7,21 @@ import "package:photos/ui/components/menu_item_widget/menu_item_widget.dart";
import "package:photos/ui/components/title_bar_title_widget.dart";
import "package:photos/ui/components/title_bar_widget.dart";
import "package:photos/ui/components/toggle_switch_widget.dart";
-import "package:photos/ui/settings/lockscreen/lockscreen_password.dart";
-import "package:photos/ui/settings/lockscreen/lockscreen_pin.dart";
+import "package:photos/ui/settings/lock_screen/lock_screen_password.dart";
+import "package:photos/ui/settings/lock_screen/lock_screen_pin.dart";
import "package:photos/ui/tools/app_lock.dart";
-import "package:photos/utils/lockscreen_setting.dart";
+import "package:photos/utils/lock_screen_settings.dart";
-class LockScreenOption extends StatefulWidget {
- const LockScreenOption({super.key});
+class LockScreenOptions extends StatefulWidget {
+ const LockScreenOptions({super.key});
@override
- State<LockScreenOption> createState() => _LockScreenOptionState();
+ State<LockScreenOptions> createState() => _LockScreenOptionsState();
}
-class _LockScreenOptionState extends State<LockScreenOption> {
+class _LockScreenOptionsState extends State<LockScreenOptions> {
final Configuration _configuration = Configuration.instance;
- final LockscreenSetting _lockscreenSetting = LockscreenSetting.instance;
+ final LockScreenSettings _lockscreenSetting = LockScreenSettings.instance;
late bool appLock;
bool isPinEnabled = false;
bool isPasswordEnabled = false;
diff --git a/mobile/lib/ui/settings/lockscreen/lockscreen_password.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_password.dart
similarity index 95%
rename from mobile/lib/ui/settings/lockscreen/lockscreen_password.dart
rename to mobile/lib/ui/settings/lock_screen/lock_screen_password.dart
index 935235af13..eba1d6f338 100644
--- a/mobile/lib/ui/settings/lockscreen/lockscreen_password.dart
+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_password.dart
@@ -8,10 +8,10 @@ import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/common/dynamic_fab.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
import "package:photos/ui/components/text_input_widget.dart";
-import "package:photos/ui/settings/lockscreen/lock_screen_option.dart";
-import "package:photos/ui/settings/lockscreen/lockscreen_confirm_password.dart";
+import "package:photos/ui/settings/lock_screen/lock_screen_confirm_password.dart";
+import "package:photos/ui/settings/lock_screen/lock_screen_options.dart";
import "package:photos/utils/crypto_util.dart";
-import "package:photos/utils/lockscreen_setting.dart";
+import "package:photos/utils/lock_screen_settings.dart";
class LockScreenPassword extends StatefulWidget {
const LockScreenPassword({
@@ -38,7 +38,7 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
final _submitNotifier = ValueNotifier(false);
int invalidAttemptsCount = 0;
- final LockscreenSetting _lockscreenSetting = LockscreenSetting.instance;
+ final LockScreenSettings _lockscreenSetting = LockScreenSettings.instance;
late String enteredHashedPassword;
@override
void initState() {
@@ -74,7 +74,7 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
? Navigator.of(context).pop(true)
: Navigator.of(context).pushReplacement(
MaterialPageRoute(
- builder: (context) => const LockScreenOption(),
+ builder: (context) => const LockScreenOptions(),
),
);
return true;
diff --git a/mobile/lib/ui/settings/lockscreen/lockscreen_pin.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_pin.dart
similarity index 97%
rename from mobile/lib/ui/settings/lockscreen/lockscreen_pin.dart
rename to mobile/lib/ui/settings/lock_screen/lock_screen_pin.dart
index c96726e246..d1328bc8b3 100644
--- a/mobile/lib/ui/settings/lockscreen/lockscreen_pin.dart
+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_pin.dart
@@ -7,10 +7,10 @@ import "package:photos/theme/colors.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/theme/text_style.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
-import "package:photos/ui/settings/lockscreen/lock_screen_option.dart";
-import "package:photos/ui/settings/lockscreen/lockscreen_confirm_pin.dart";
+import "package:photos/ui/settings/lock_screen/lock_screen_confirm_pin.dart";
+import "package:photos/ui/settings/lock_screen/lock_screen_options.dart";
import "package:photos/utils/crypto_util.dart";
-import "package:photos/utils/lockscreen_setting.dart";
+import "package:photos/utils/lock_screen_settings.dart";
import 'package:pinput/pinput.dart';
class LockScreenPin extends StatefulWidget {
@@ -33,7 +33,7 @@ class LockScreenPin extends StatefulWidget {
class _LockScreenPinState extends State<LockScreenPin> {
final _pinController = TextEditingController(text: null);
- final LockscreenSetting _lockscreenSetting = LockscreenSetting.instance;
+ final LockScreenSettings _lockscreenSetting = LockScreenSettings.instance;
late String enteredHashedPin;
bool isPinValid = false;
int invalidAttemptsCount = 0;
@@ -80,7 +80,7 @@ class _LockScreenPinState extends State<LockScreenPin> {
? Navigator.of(context).pop(true)
: Navigator.of(context).pushReplacement(
MaterialPageRoute(
- builder: (context) => const LockScreenOption(),
+ builder: (context) => const LockScreenOptions(),
),
);
return true;
diff --git a/mobile/lib/ui/settings/security_section_widget.dart b/mobile/lib/ui/settings/security_section_widget.dart
index a9e89c10c7..490dacb3fc 100644
--- a/mobile/lib/ui/settings/security_section_widget.dart
+++ b/mobile/lib/ui/settings/security_section_widget.dart
@@ -21,7 +21,7 @@ import 'package:photos/ui/components/expandable_menu_item_widget.dart';
import 'package:photos/ui/components/menu_item_widget/menu_item_widget.dart';
import 'package:photos/ui/components/toggle_switch_widget.dart';
import 'package:photos/ui/settings/common_settings.dart';
-import "package:photos/ui/settings/lockscreen/lock_screen_option.dart";
+import "package:photos/ui/settings/lock_screen/lock_screen_options.dart";
import "package:photos/utils/auth_util.dart";
import "package:photos/utils/crypto_util.dart";
import "package:photos/utils/dialog_util.dart";
@@ -154,7 +154,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
- return const LockScreenOption();
+ return const LockScreenOptions();
},
),
);
diff --git a/mobile/lib/ui/tools/lock_screen.dart b/mobile/lib/ui/tools/lock_screen.dart
index 636a9d5a0e..752996a8d9 100644
--- a/mobile/lib/ui/tools/lock_screen.dart
+++ b/mobile/lib/ui/tools/lock_screen.dart
@@ -10,7 +10,7 @@ import 'package:photos/ui/common/gradient_button.dart';
import "package:photos/ui/components/buttons/icon_button_widget.dart";
import 'package:photos/ui/tools/app_lock.dart';
import 'package:photos/utils/auth_util.dart';
-import "package:photos/utils/lockscreen_setting.dart";
+import "package:photos/utils/lock_screen_settings.dart";
class LockScreen extends StatefulWidget {
const LockScreen({Key? key}) : super(key: key);
@@ -31,7 +31,7 @@ class _LockScreenState extends State<LockScreen>
int invalidAttemptCount = 0;
int remainingTime = 0;
bool showErrorMessage = true;
- final _lockscreenSetting = LockscreenSetting.instance;
+ final _lockscreenSetting = LockScreenSettings.instance;
late final AnimationController _controller = AnimationController(
duration: const Duration(milliseconds: 500),
vsync: this,
diff --git a/mobile/lib/utils/auth_util.dart b/mobile/lib/utils/auth_util.dart
index 0fa14db811..dca030d4aa 100644
--- a/mobile/lib/utils/auth_util.dart
+++ b/mobile/lib/utils/auth_util.dart
@@ -5,7 +5,7 @@ import 'package:local_auth_ios/local_auth_ios.dart';
import 'package:logging/logging.dart';
import "package:photos/generated/l10n.dart";
import "package:photos/services/local_authentication_service.dart";
-import "package:photos/utils/lockscreen_setting.dart";
+import "package:photos/utils/lock_screen_settings.dart";
Future<bool> requestAuthentication(
BuildContext context,
@@ -15,7 +15,7 @@ Future<bool> requestAuthentication(
Logger("AuthUtil").info("Requesting authentication");
await LocalAuthentication().stopAuthentication();
- final LockscreenSetting lockscreenSetting = LockscreenSetting.instance;
+ final LockScreenSettings lockscreenSetting = LockScreenSettings.instance;
final String? savedPin = await lockscreenSetting.getPin();
final String? savedPassword = await lockscreenSetting.getPassword();
if (savedPassword != null || savedPin != null) {
diff --git a/mobile/lib/utils/lockscreen_setting.dart b/mobile/lib/utils/lock_screen_settings.dart
similarity index 95%
rename from mobile/lib/utils/lockscreen_setting.dart
rename to mobile/lib/utils/lock_screen_settings.dart
index 45728af929..85117269fd 100644
--- a/mobile/lib/utils/lockscreen_setting.dart
+++ b/mobile/lib/utils/lock_screen_settings.dart
@@ -6,11 +6,11 @@ import "package:flutter_sodium/flutter_sodium.dart";
import "package:photos/utils/crypto_util.dart";
import "package:shared_preferences/shared_preferences.dart";
-class LockscreenSetting {
- LockscreenSetting._privateConstructor();
+class LockScreenSettings {
+ LockScreenSettings._privateConstructor();
- static final LockscreenSetting instance =
- LockscreenSetting._privateConstructor();
+ static final LockScreenSettings instance =
+ LockScreenSettings._privateConstructor();
static const password = "user_pass";
static const pin = "user_pin";
static const saltKey = "user_salt";