π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Lint lock_screen
vishnukvmd0455481f3d5c
diff --git a/mobile/packages/lock_screen/analysis_options.yaml b/mobile/packages/lock_screen/analysis_options.yamlnew file mode 100644index 0000000000..1bd78bc1b0--- /dev/null+++ b/mobile/packages/lock_screen/analysis_options.yaml@@ -0,0 +1,72 @@+# For more linters, we can check https://dart-lang.github.io/linter/lints/index.html+# or https://pub.dev/packages/lint (Effective dart)+# use "flutter analyze ." or "dart analyze ." for running lint checks++include: package:flutter_lints/flutter.yaml+linter:+ rules:+ # Ref https://github.com/flutter/packages/blob/master/packages/flutter_lints/lib/flutter.yaml+ # Ref https://dart-lang.github.io/linter/lints/+ - avoid_print+ - avoid_unnecessary_containers+ - avoid_web_libraries_in_flutter+ - no_logic_in_create_state+ - prefer_const_constructors+ - prefer_const_constructors_in_immutables+ - prefer_const_declarations+ - prefer_const_literals_to_create_immutables+ - prefer_final_locals+ - require_trailing_commas+ - sized_box_for_whitespace+ - use_full_hex_values_for_flutter_colors+ - use_key_in_widget_constructors+ - cancel_subscriptions+++ - avoid_empty_else+ - exhaustive_cases++ # just style suggestions+ - sort_pub_dependencies+ - use_rethrow_when_possible+ - prefer_double_quotes+ - directives_ordering+ - always_use_package_imports+ - sort_child_properties_last+ - unawaited_futures++analyzer:+ errors:+ avoid_empty_else: error+ exhaustive_cases: error+ curly_braces_in_flow_control_structures: error+ directives_ordering: error+ require_trailing_commas: error+ always_use_package_imports: warning+ prefer_final_fields: error+ unused_import: error+ camel_case_types: error+ prefer_is_empty: warning+ use_rethrow_when_possible: info+ unused_field: warning+ use_key_in_widget_constructors: warning+ sort_child_properties_last: warning+ sort_pub_dependencies: warning+ library_private_types_in_public_api: warning+ constant_identifier_names: ignore+ prefer_const_constructors: warning+ prefer_const_declarations: warning+ prefer_const_constructors_in_immutables: warning+ prefer_final_locals: warning+ unnecessary_const: error+ cancel_subscriptions: error+ unrelated_type_equality_checks: error+ unnecessary_cast: info+++ unawaited_futures: warning # convert to warning after fixing existing issues+ invalid_dependency: info+ use_build_context_synchronously: ignore # experimental lint, requires many changes+ prefer_interpolation_to_compose_strings: ignore # later too many warnings+ prefer_double_quotes: ignore # too many warnings+ avoid_renaming_method_parameters: ignore # incorrect warnings for `equals` overridesdiff --git a/mobile/packages/lock_screen/lib/auth_util.dart b/mobile/packages/lock_screen/lib/auth_util.dartindex 396be4f809..f4071b0712 100644--- a/mobile/packages/lock_screen/lib/auth_util.dart+++ b/mobile/packages/lock_screen/lib/auth_util.dart@@ -1,13 +1,13 @@import 'dart:io';+import 'package:ente_lock_screen/local_authentication_service.dart';+import 'package:ente_lock_screen/lock_screen_settings.dart';import 'package:ente_strings/ente_strings.dart';import 'package:flutter/cupertino.dart';import 'package:flutter_local_authentication/flutter_local_authentication.dart';import 'package:local_auth/local_auth.dart';import 'package:local_auth_android/local_auth_android.dart';import 'package:local_auth_darwin/types/auth_messages_ios.dart';-import 'package:ente_lock_screen/local_authentication_service.dart';-import 'package:ente_lock_screen/lock_screen_settings.dart';import 'package:logging/logging.dart';Future<bool> requestAuthentication(diff --git a/mobile/packages/lock_screen/lib/local_authentication_service.dart b/mobile/packages/lock_screen/lib/local_authentication_service.dartindex 6ae795c61e..eb1a65cf05 100644--- a/mobile/packages/lock_screen/lib/local_authentication_service.dart+++ b/mobile/packages/lock_screen/lib/local_authentication_service.dart@@ -1,5 +1,10 @@import 'dart:io';+import 'package:ente_lock_screen/auth_util.dart';+import 'package:ente_lock_screen/lock_screen_settings.dart';+import 'package:ente_lock_screen/ui/app_lock.dart';+import 'package:ente_lock_screen/ui/lock_screen_password.dart';+import 'package:ente_lock_screen/ui/lock_screen_pin.dart';import 'package:ente_ui/utils/dialog_util.dart';import 'package:ente_ui/utils/toast_util.dart';import 'package:flutter/foundation.dart';@@ -7,11 +12,6 @@ import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_local_authentication/flutter_local_authentication.dart';import 'package:local_auth/local_auth.dart';-import 'package:ente_lock_screen/auth_util.dart';-import 'package:ente_lock_screen/lock_screen_settings.dart';-import 'package:ente_lock_screen/ui/app_lock.dart';-import 'package:ente_lock_screen/ui/lock_screen_password.dart';-import 'package:ente_lock_screen/ui/lock_screen_pin.dart';import 'package:logging/logging.dart';class LocalAuthenticationService {diff --git a/mobile/packages/lock_screen/lib/lock_screen_settings.dart b/mobile/packages/lock_screen/lib/lock_screen_settings.dartindex 99a41478bf..2c631bc931 100644--- a/mobile/packages/lock_screen/lib/lock_screen_settings.dart+++ b/mobile/packages/lock_screen/lib/lock_screen_settings.dart@@ -3,10 +3,10 @@ import "dart:io";import "dart:typed_data";import "package:ente_configuration/base_configuration.dart";-import "package:ente_utils/platform_util.dart";+import "package:ente_crypto_dart/ente_crypto_dart.dart";import "package:ente_events/event_bus.dart";import "package:ente_events/models/signed_out_event.dart";-import "package:ente_crypto_dart/ente_crypto_dart.dart";+import "package:ente_utils/platform_util.dart";import "package:flutter/material.dart";import "package:flutter_secure_storage/flutter_secure_storage.dart";import "package:privacy_screen/privacy_screen.dart";diff --git a/mobile/packages/lock_screen/lib/ui/app_lock.dart b/mobile/packages/lock_screen/lib/ui/app_lock.dartindex f72fa1e8a5..9098737b7f 100644--- a/mobile/packages/lock_screen/lib/ui/app_lock.dart+++ b/mobile/packages/lock_screen/lib/ui/app_lock.dart@@ -1,7 +1,7 @@import 'dart:async';-import 'package:flutter/material.dart';import 'package:ente_lock_screen/lock_screen_settings.dart';+import 'package:flutter/material.dart';/// A widget which handles app lifecycle events for showing and hiding a lock screen./// This should wrap around a `MyApp` widget (or equivalent).@@ -144,8 +144,8 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {Widget get _lockScreen {return PopScope(- child: this.widget.lockScreen,canPop: false,+ child: this.widget.lockScreen,);}diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen.dart b/mobile/packages/lock_screen/lib/ui/lock_screen.dartindex e89869b740..270d201eba 100644--- a/mobile/packages/lock_screen/lib/ui/lock_screen.dart+++ b/mobile/packages/lock_screen/lib/ui/lock_screen.dart@@ -3,15 +3,15 @@ import 'dart:math';import 'package:ente_accounts/ente_accounts.dart';import 'package:ente_configuration/base_configuration.dart';+import 'package:ente_lock_screen/auth_util.dart';+import 'package:ente_lock_screen/lock_screen_settings.dart';+import 'package:ente_lock_screen/ui/app_lock.dart';import 'package:ente_strings/ente_strings.dart';import 'package:ente_ui/theme/ente_theme.dart';import 'package:ente_ui/utils/dialog_util.dart';import 'package:flutter/material.dart';import 'package:flutter/scheduler.dart';import 'package:flutter_animate/flutter_animate.dart';-import 'package:ente_lock_screen/auth_util.dart';-import 'package:ente_lock_screen/lock_screen_settings.dart';-import 'package:ente_lock_screen/ui/app_lock.dart';import 'package:logging/logging.dart';class LockScreen extends StatefulWidget {diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_auto_lock.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_auto_lock.dartindex 1f0901ed50..16b5f45ffe 100644--- a/mobile/packages/lock_screen/lib/ui/lock_screen_auto_lock.dart+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_auto_lock.dart@@ -1,3 +1,4 @@+import 'package:ente_lock_screen/lock_screen_settings.dart';import 'package:ente_strings/ente_strings.dart';import 'package:ente_ui/components/captioned_text_widget.dart';import 'package:ente_ui/components/divider_widget.dart';@@ -7,7 +8,6 @@ import 'package:ente_ui/components/title_bar_title_widget.dart';import 'package:ente_ui/components/title_bar_widget.dart';import 'package:ente_ui/theme/ente_theme.dart';import 'package:flutter/material.dart';-import 'package:ente_lock_screen/lock_screen_settings.dart';class LockScreenAutoLock extends StatefulWidget {const LockScreenAutoLock({super.key});diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_password.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_password.dartindex 716a1ad7da..eb9e8d6824 100644--- a/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_password.dart+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_password.dart@@ -1,3 +1,4 @@+import "package:ente_lock_screen/lock_screen_settings.dart";import "package:ente_strings/ente_strings.dart";import "package:ente_ui/components/buttons/dynamic_fab.dart";import "package:ente_ui/components/buttons/icon_button_widget.dart";@@ -5,7 +6,6 @@ import "package:ente_ui/components/text_input_widget.dart";import "package:ente_ui/theme/ente_theme.dart";import "package:flutter/material.dart";import "package:flutter/services.dart";-import "package:ente_lock_screen/lock_screen_settings.dart";class LockScreenConfirmPassword extends StatefulWidget {const LockScreenConfirmPassword({diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_pin.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_pin.dartindex 33ce921012..ecb4418968 100644--- a/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_pin.dart+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_pin.dart@@ -1,11 +1,11 @@import "dart:io";+import "package:ente_lock_screen/lock_screen_settings.dart";+import "package:ente_lock_screen/ui/custom_pin_keypad.dart";import "package:ente_strings/ente_strings.dart";import "package:ente_ui/theme/ente_theme.dart";import "package:flutter/material.dart";import "package:flutter/services.dart";-import "package:ente_lock_screen/lock_screen_settings.dart";-import "package:ente_lock_screen/ui/custom_pin_keypad.dart";import "package:pinput/pinput.dart";class LockScreenConfirmPin extends StatefulWidget {diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_options.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_options.dartindex 2bf9d21131..176172af95 100644--- a/mobile/packages/lock_screen/lib/ui/lock_screen_options.dart+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_options.dart@@ -1,6 +1,12 @@import "dart:async";import "dart:io";+import "package:ente_lock_screen/local_authentication_service.dart";+import "package:ente_lock_screen/lock_screen_settings.dart";+import "package:ente_lock_screen/ui/app_lock.dart";+import "package:ente_lock_screen/ui/lock_screen_auto_lock.dart";+import "package:ente_lock_screen/ui/lock_screen_password.dart";+import "package:ente_lock_screen/ui/lock_screen_pin.dart";import "package:ente_strings/ente_strings.dart";import "package:ente_ui/components/buttons/button_widget.dart";import "package:ente_ui/components/buttons/models/button_type.dart";@@ -14,12 +20,6 @@ import "package:ente_ui/components/toggle_switch_widget.dart";import "package:ente_ui/theme/ente_theme.dart";import "package:ente_utils/platform_util.dart";import "package:flutter/material.dart";-import "package:ente_lock_screen/local_authentication_service.dart";-import "package:ente_lock_screen/lock_screen_settings.dart";-import "package:ente_lock_screen/ui/app_lock.dart";-import "package:ente_lock_screen/ui/lock_screen_auto_lock.dart";-import "package:ente_lock_screen/ui/lock_screen_password.dart";-import "package:ente_lock_screen/ui/lock_screen_pin.dart";class LockScreenOptions extends StatefulWidget {const LockScreenOptions({super.key});diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_password.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_password.dartindex 93a1c4d636..eb5f2b94ed 100644--- a/mobile/packages/lock_screen/lib/ui/lock_screen_password.dart+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_password.dart@@ -1,16 +1,16 @@import "dart:convert";+import "package:ente_crypto_dart/ente_crypto_dart.dart";+import "package:ente_lock_screen/lock_screen_settings.dart";+import "package:ente_lock_screen/ui/lock_screen_confirm_password.dart";+import "package:ente_lock_screen/ui/lock_screen_options.dart";import "package:ente_strings/ente_strings.dart";import "package:ente_ui/components/buttons/dynamic_fab.dart";import "package:ente_ui/components/buttons/icon_button_widget.dart";import "package:ente_ui/components/text_input_widget.dart";import "package:ente_ui/theme/ente_theme.dart";-import "package:ente_crypto_dart/ente_crypto_dart.dart";import "package:flutter/material.dart";import "package:flutter/services.dart";-import "package:ente_lock_screen/lock_screen_settings.dart";-import "package:ente_lock_screen/ui/lock_screen_confirm_password.dart";-import "package:ente_lock_screen/ui/lock_screen_options.dart";/// [isChangingLockScreenSettings] Authentication required for changing lock screen settings./// Set to true when the app requires the user to authenticate before allowingdiff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_pin.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_pin.dartindex 2001cae468..603ebdd67d 100644--- a/mobile/packages/lock_screen/lib/ui/lock_screen_pin.dart+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_pin.dart@@ -1,17 +1,17 @@import "dart:convert";import "dart:io";+import "package:ente_crypto_dart/ente_crypto_dart.dart";+import "package:ente_lock_screen/lock_screen_settings.dart";+import "package:ente_lock_screen/ui/custom_pin_keypad.dart";+import "package:ente_lock_screen/ui/lock_screen_confirm_pin.dart";+import "package:ente_lock_screen/ui/lock_screen_options.dart";import "package:ente_strings/ente_strings.dart";import "package:ente_ui/theme/colors.dart";import "package:ente_ui/theme/ente_theme.dart";import "package:ente_ui/theme/text_style.dart";-import "package:ente_crypto_dart/ente_crypto_dart.dart";import "package:flutter/material.dart";import "package:flutter/services.dart";-import "package:ente_lock_screen/lock_screen_settings.dart";-import "package:ente_lock_screen/ui/custom_pin_keypad.dart";-import "package:ente_lock_screen/ui/lock_screen_confirm_pin.dart";-import "package:ente_lock_screen/ui/lock_screen_options.dart";import 'package:pinput/pinput.dart';/// [isChangingLockScreenSettings] Authentication required for changing lock screen settings.diff --git a/mobile/packages/lock_screen/pubspec.yaml b/mobile/packages/lock_screen/pubspec.yamlindex e5906cfc6a..5f6f1529c1 100644--- a/mobile/packages/lock_screen/pubspec.yaml+++ b/mobile/packages/lock_screen/pubspec.yaml@@ -8,8 +8,6 @@ environment:flutter: ">=1.17.0"dependencies:- flutter:- sdk: flutterente_accounts:path: ../accountsente_configuration:@@ -25,6 +23,8 @@ dependencies:path: ../uiente_utils:path: ../utils+ flutter:+ sdk: flutterflutter_animate: ^4.1.0flutter_local_authentication:git:@@ -38,8 +38,8 @@ dependencies:shared_preferences: ^2.5.3dev_dependencies:+ flutter_lints: ^5.0.0flutter_test:sdk: flutter- flutter_lints: ^5.0.0flutter: