From a9e6ebd230ba84d35768e0036bfc07d4b713333c Mon Sep 17 00:00:00 2001 From: Peter Jankuliak Date: Mon, 2 Dec 2024 12:48:16 +0100 Subject: [PATCH] Fix dart analyze --- lib/app/app.dart | 4 +- lib/app/cubits/repo.dart | 3 -- lib/app/cubits/repo_security.dart | 38 ++++++++++--------- lib/app/cubits/repos.dart | 1 - lib/app/models/access_mode.dart | 2 + lib/app/pages/onboarding_page.dart | 9 ----- lib/app/pages/repo_reset_access.dart | 35 +++++++---------- lib/app/pages/repo_security_page.dart | 10 ++--- lib/app/utils/dialogs.dart | 3 +- lib/app/utils/settings/v1.dart | 1 - lib/app/utils/settings/v2.dart | 2 - lib/app/widgets/bars/repositories_bar.dart | 2 - .../buttons/dialog_negative_button.dart | 2 +- .../buttons/dialog_positive_button.dart | 4 +- .../buttons/link_style_async_button.dart | 2 +- .../dialogs/dokan_different_mayor_found.dart | 3 +- lib/app/widgets/dialogs/dokan_not_found.dart | 3 +- .../dialogs/get_password_access_dialog.dart | 27 ++++++------- .../modal_rename_repository_dialog.dart | 1 - lib/app/widgets/items/list_item.dart | 1 - lib/app/widgets/repo_creation.dart | 3 +- .../selectors/access_mode_selector.dart | 1 - lib/app/widgets/settings/about_section.dart | 1 - .../settings/app_settings_container.dart | 1 - .../states/locked_repository_state.dart | 1 - ouisync | 2 +- .../create_repo_from_blind_token_test.dart | 1 - test/unit/settings_test.dart | 1 - test/utils.dart | 7 ++-- test/widget/navigation.dart | 3 -- test/widget/repo_creation_test.dart | 1 - test/widget/repo_security_test.dart | 2 +- test/widget/unlock_test.dart | 1 - 33 files changed, 64 insertions(+), 114 deletions(-) diff --git a/lib/app/app.dart b/lib/app/app.dart index 76800dc9f..15a651ed9 100644 --- a/lib/app/app.dart +++ b/lib/app/app.dart @@ -288,8 +288,8 @@ class ErrorScreen extends StatelessWidget { // resulting in black screens. This class should help us find those race conditions. class _AppNavigatorObserver extends NavigatorObserver { final int _maxHistoryLength = 16; - List<_RouteHistoryEntry> _stackHistory = []; - Loggy _logger; + final List<_RouteHistoryEntry> _stackHistory = []; + final Loggy _logger; _AppNavigatorObserver(this._logger); diff --git a/lib/app/cubits/repo.dart b/lib/app/cubits/repo.dart index 04da52014..c602afbd9 100644 --- a/lib/app/cubits/repo.dart +++ b/lib/app/cubits/repo.dart @@ -13,12 +13,9 @@ import 'package:stream_transform/stream_transform.dart'; import '../../generated/l10n.dart'; import '../models/models.dart'; -import '../utils/master_key.dart'; -import '../utils/mounter.dart'; import '../utils/repo_path.dart' as repo_path; import '../utils/utils.dart'; import 'cubits.dart'; -import 'utils.dart'; class RepoState extends Equatable { final bool isLoading; diff --git a/lib/app/cubits/repo_security.dart b/lib/app/cubits/repo_security.dart index ab016d714..fe264927a 100644 --- a/lib/app/cubits/repo_security.dart +++ b/lib/app/cubits/repo_security.dart @@ -9,10 +9,8 @@ import '../models/models.dart' AuthModeKeyStoredOnDevice, AuthModePasswordStoredOnDevice, UnlockedAccess, - LocalSecret, LocalSecretKeyAndSalt, LocalSecretInput, - LocalSecretKey, LocalSecretManual, LocalSecretMode, LocalSecretRandom, @@ -56,7 +54,7 @@ class RepoSecurityState { final SecretKeyOrigin plannedOrigin; final bool plannedStoreSecret; - final _TriBool plannedWithBiometrics; + final BiometricsValue plannedWithBiometrics; final Option plannedPassword; final bool isBiometricsAvailable; @@ -65,20 +63,20 @@ class RepoSecurityState { required this.current, SecretKeyOrigin? plannedOrigin, bool? plannedStoreSecret, - _TriBool? plannedWithBiometrics, + BiometricsValue? plannedWithBiometrics, this.plannedPassword = const None(), this.isBiometricsAvailable = false, }) : plannedOrigin = plannedOrigin ?? current.localSecretMode.origin, plannedStoreSecret = plannedStoreSecret ?? current.localSecretMode.store.isStored, plannedWithBiometrics = plannedWithBiometrics ?? - _TriBool(current.localSecretMode.isSecuredWithBiometrics); + BiometricsValue(current.localSecretMode.isSecuredWithBiometrics); RepoSecurityState copyWith({ RepoSecurityCurrentState? current, SecretKeyOrigin? plannedOrigin, bool? plannedStoreSecret, - _TriBool? plannedWithBiometrics, + BiometricsValue? plannedWithBiometrics, Option? plannedPassword, bool? isBiometricsAvailable, }) => @@ -217,12 +215,12 @@ class RepoSecurityCubit extends Cubit void setStore(bool value) { final plannedWithBiometrics = switch ((value, state.plannedWithBiometrics)) { - (true, _True()) => _True(), - (true, _False()) => _False(), - (true, _ImpliedFalse()) => _True(), - (false, _True()) => _ImpliedFalse(), - (false, _False()) => _False(), - (false, _ImpliedFalse()) => _ImpliedFalse(), + (true, BiometricsTrue()) => BiometricsTrue(), + (true, BiometricsFalse()) => BiometricsFalse(), + (true, BiometricsImpliedFalse()) => BiometricsTrue(), + (false, BiometricsTrue()) => BiometricsImpliedFalse(), + (false, BiometricsFalse()) => BiometricsFalse(), + (false, BiometricsImpliedFalse()) => BiometricsImpliedFalse(), }; emitUnlessClosed(state.copyWith( @@ -231,7 +229,8 @@ class RepoSecurityCubit extends Cubit } void setSecureWithBiometrics(bool value) { - emitUnlessClosed(state.copyWith(plannedWithBiometrics: _TriBool(value))); + emitUnlessClosed( + state.copyWith(plannedWithBiometrics: BiometricsValue(value))); } void setLocalPassword(String? value) { @@ -376,21 +375,24 @@ Future<(LocalSecretKeyAndSalt?, AuthMode)> _computeLocalSecretAndAuthMode( //-------------------------------------------------------------------- -sealed class _TriBool { +sealed class BiometricsValue { bool get toBool; - factory _TriBool(bool b) => b ? _True() : _False(); + factory BiometricsValue(bool b) => b ? BiometricsTrue() : BiometricsFalse(); } -class _True implements _TriBool { +class BiometricsTrue implements BiometricsValue { + @override bool get toBool => true; } -class _False implements _TriBool { +class BiometricsFalse implements BiometricsValue { + @override bool get toBool => false; } -class _ImpliedFalse implements _TriBool { +class BiometricsImpliedFalse implements BiometricsValue { + @override bool get toBool => false; } diff --git a/lib/app/cubits/repos.dart b/lib/app/cubits/repos.dart index aa357722b..c4cd3f40f 100644 --- a/lib/app/cubits/repos.dart +++ b/lib/app/cubits/repos.dart @@ -8,7 +8,6 @@ import 'package:ouisync/state_monitor.dart'; import '../../generated/l10n.dart'; import '../models/models.dart'; -import '../utils/mounter.dart'; import '../utils/utils.dart'; import 'cubits.dart'; diff --git a/lib/app/models/access_mode.dart b/lib/app/models/access_mode.dart index bad45cd66..169e7ad92 100644 --- a/lib/app/models/access_mode.dart +++ b/lib/app/models/access_mode.dart @@ -72,6 +72,7 @@ class BlindAccess implements Access { } class ReadAccess implements Access, UnlockedAccess { + @override LocalSecret localSecret; ReadAccess(this.localSecret); @@ -90,6 +91,7 @@ class ReadAccess implements Access, UnlockedAccess { } class WriteAccess implements Access, UnlockedAccess { + @override LocalSecret localSecret; WriteAccess(this.localSecret); diff --git a/lib/app/pages/onboarding_page.dart b/lib/app/pages/onboarding_page.dart index 8ac5d77e9..41aff3e4d 100644 --- a/lib/app/pages/onboarding_page.dart +++ b/lib/app/pages/onboarding_page.dart @@ -4,7 +4,6 @@ import 'package:introduction_screen/introduction_screen.dart'; import 'language_picker_page.dart'; import 'accept_eq_values_terms_privacy_page.dart'; import '../../generated/l10n.dart'; -import '../utils/click_counter.dart'; import '../cubits/locale.dart'; import '../utils/utils.dart'; @@ -188,14 +187,6 @@ class _OnboardingPageState extends State { width: _imageWidth * 0.6, ); - Widget _buildButton(String text) => Fields.inPageButton( - text: text, - size: Dimensions.sizeInPageButtonMicro, - backgroundColor: Theme.of(context).colorScheme.surfaceContainer, - foregroundColor: Theme.of(context).colorScheme.surfaceTint, - onPressed: null, - ); - // For debugging //@override //String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) => diff --git a/lib/app/pages/repo_reset_access.dart b/lib/app/pages/repo_reset_access.dart index a8790affc..a77891659 100644 --- a/lib/app/pages/repo_reset_access.dart +++ b/lib/app/pages/repo_reset_access.dart @@ -9,14 +9,7 @@ import '../models/auth_mode.dart'; import '../models/access_mode.dart'; import '../cubits/cubits.dart' show RepoCubit, RepoState; import '../utils/utils.dart' - show - AppThemeExtension, - Constants, - Dimensions, - Fields, - LocalAuth, - Settings, - ThemeGetter; + show AppThemeExtension, Constants, Fields, LocalAuth, Settings, ThemeGetter; import '../widgets/widgets.dart' show ActionsDialog, DirectionalAppBar, PositiveButton, NegativeButton; @@ -34,9 +27,7 @@ class RepoResetAccessPage extends StatefulWidget { builder: (context) => RepoResetAccessPage._(repo, startAccess, settings)); - Navigator.push(context, route); - - return (await route.popped)!; + return (await Navigator.push(context, route)) ?? startAccess; } RepoResetAccessPage._( @@ -51,13 +42,13 @@ class RepoResetAccessPage extends StatefulWidget { } class RepoResetAccessPageState extends State { - _TokenStatus tokenStatus; + _TokenStatus _tokenStatus; Access currentAccess; RepoResetAccessPageState(this.currentAccess) - : tokenStatus = _InvalidTokenStatus(_InvalidTokenType.empty); + : _tokenStatus = _InvalidTokenStatus(_InvalidTokenType.empty); - bool get hasPendingChanges => tokenStatus is _SubmitableTokenStatus; + bool get hasPendingChanges => _tokenStatus is _SubmitableTokenStatus; @override Widget build(BuildContext context) => PopScope( @@ -171,7 +162,7 @@ class RepoResetAccessPageState extends State { } Widget _buildTokenInfo() { - final info = switch (tokenStatus) { + final info = switch (_tokenStatus) { _SubmitableTokenStatus status => _capitalized(status.inputToken.accessMode.localized), _SubmittedTokenStatus status => @@ -192,13 +183,13 @@ class RepoResetAccessPageState extends State { // Capitalize first letter of a string String _capitalized(String str) { - return str.length > 0 + return str.isNotEmpty ? '${str[0].toUpperCase()}${str.substring(1).toLowerCase()}' : str; } Widget _buildActionInfo() { - final (action, warning) = switch (tokenStatus) { + final (action, warning) = switch (_tokenStatus) { _SubmitableTokenStatus status => _buildTokenStatusSubmitable(status), _SubmittedTokenStatus status => _buildTokenStatusSubmitted(status), _InvalidTokenStatus status => _buildTokenStatusInvalid(status), @@ -281,7 +272,7 @@ class RepoResetAccessPageState extends State { suffixIcon: const Icon(Icons.key_rounded), onChanged: (input) { widget._jobs.addJob(() async { - final inputToken = await parseTokenInput(input); + final inputToken = await _parseTokenInput(input); _updateTokenStatusOnTokenInputChange(inputToken); }); }, @@ -292,7 +283,7 @@ class RepoResetAccessPageState extends State { Widget _buildSubmitButton() { Future Function()? onPressed; - switch (tokenStatus) { + switch (_tokenStatus) { case _SubmitableTokenStatus valid: onPressed = () async { if (await _confirmUpdateDialog()) { @@ -403,7 +394,7 @@ class RepoResetAccessPageState extends State { await repo.setAuthMode(newAuthMode); setState(() { - tokenStatus = _SubmittedTokenStatus(input); + _tokenStatus = _SubmittedTokenStatus(input); this.currentAccess = currentAccess; }); } @@ -427,14 +418,14 @@ class RepoResetAccessPageState extends State { if (mounted) { setState(() { - tokenStatus = newStatus; + _tokenStatus = newStatus; }); } } // ----------------------------------------------------------------- - Future<_InputToken> parseTokenInput(String input) async { + Future<_InputToken> _parseTokenInput(String input) async { if (input.isEmpty) { return _InvalidInputToken.empty(); } diff --git a/lib/app/pages/repo_security_page.dart b/lib/app/pages/repo_security_page.dart index 68acd0e1c..5eb091486 100644 --- a/lib/app/pages/repo_security_page.dart +++ b/lib/app/pages/repo_security_page.dart @@ -7,13 +7,11 @@ import '../../generated/l10n.dart'; import '../pages/repo_reset_access.dart'; import '../cubits/cubits.dart' show RepoCubit, RepoSecurityCubit, RepoSecurityState; -import '../models/models.dart' - show Access, UnlockedAccess, BlindAccess, ReadAccess, WriteAccess; +import '../models/models.dart' show UnlockedAccess; import '../utils/utils.dart' show AppThemeExtension, Dialogs, - Dimensions, Fields, PasswordHasher, Settings, @@ -26,10 +24,8 @@ import '../widgets/widgets.dart' DirectionalAppBar, LinkStyleAsyncButton, CustomAdaptiveSwitch, - PasswordValidation, - ScrollableTextWidget; + PasswordValidation; import '../models/models.dart' show SecretKeyOrigin; -import '../utils/platform/platform_values.dart' show PlatformValues; //-------------------------------------------------------------------- @@ -125,7 +121,7 @@ class _State extends State { final newAccess = await RepoResetAccessPage.show( access, context, widget.repo, widget.settings); - final unlockedAccess = newAccess?.asUnlocked; + final unlockedAccess = newAccess.asUnlocked; if (unlockedAccess == null) { Navigator.pop(context); diff --git a/lib/app/utils/dialogs.dart b/lib/app/utils/dialogs.dart index eecfc5877..90af6f4ed 100644 --- a/lib/app/utils/dialogs.dart +++ b/lib/app/utils/dialogs.dart @@ -7,8 +7,7 @@ import '../../generated/l10n.dart'; import '../cubits/cubits.dart' show RepoCubit; import '../widgets/widgets.dart' show ActionsDialog, NegativeButton, PositiveButton; -import 'utils.dart' - show AppThemeExtension, Dimensions, Fields, Strings, ThemeGetter; +import 'utils.dart' show AppThemeExtension, Fields, Strings, ThemeGetter; abstract class Dialogs { static int _loadingInvocations = 0; diff --git a/lib/app/utils/settings/v1.dart b/lib/app/utils/settings/v1.dart index 09b309987..31a216c8b 100644 --- a/lib/app/utils/settings/v1.dart +++ b/lib/app/utils/settings/v1.dart @@ -10,7 +10,6 @@ import 'package:shared_preferences/shared_preferences.dart'; import '../../models/models.dart'; import '../files.dart'; -import '../master_key.dart'; import '../utils.dart'; import 'atomic_shared_prefs_settings_key.dart'; import 'v0/v0.dart' as v0; diff --git a/lib/app/utils/settings/v2.dart b/lib/app/utils/settings/v2.dart index 1be3359eb..696a8cc35 100644 --- a/lib/app/utils/settings/v2.dart +++ b/lib/app/utils/settings/v2.dart @@ -6,9 +6,7 @@ import 'package:path/path.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../../models/models.dart'; -import '../master_key.dart'; import '../utils.dart'; -import '../option.dart'; import 'atomic_shared_prefs_settings_key.dart'; import 'v1.dart' as v1; diff --git a/lib/app/widgets/bars/repositories_bar.dart b/lib/app/widgets/bars/repositories_bar.dart index 04490da91..af5131406 100644 --- a/lib/app/widgets/bars/repositories_bar.dart +++ b/lib/app/widgets/bars/repositories_bar.dart @@ -8,8 +8,6 @@ import '../../cubits/cubits.dart'; import '../../models/models.dart'; import '../../utils/utils.dart'; import '../notification_badge.dart'; -import '../repo_status.dart'; -import '../throughput_display.dart'; import '../widgets.dart'; class RepositoriesBar extends StatelessWidget diff --git a/lib/app/widgets/buttons/dialog_negative_button.dart b/lib/app/widgets/buttons/dialog_negative_button.dart index 5c8171bd7..d152a0d21 100644 --- a/lib/app/widgets/buttons/dialog_negative_button.dart +++ b/lib/app/widgets/buttons/dialog_negative_button.dart @@ -10,7 +10,7 @@ class NegativeButton extends StatelessWidget { this.buttonConstrains = Dimensions.sizeConstrainsDialogAction, this.focusNode, super.key, - }) : this.buttonsAspectRatio = + }) : buttonsAspectRatio = buttonsAspectRatio ?? Dimensions.aspectRatioModalDialogButton; final String? text; diff --git a/lib/app/widgets/buttons/dialog_positive_button.dart b/lib/app/widgets/buttons/dialog_positive_button.dart index 4e3cb298b..0ac3bb317 100644 --- a/lib/app/widgets/buttons/dialog_positive_button.dart +++ b/lib/app/widgets/buttons/dialog_positive_button.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import '../../utils/utils.dart'; class PositiveButton extends StatelessWidget { - const PositiveButton({ + PositiveButton({ required this.text, required this.onPressed, double? buttonsAspectRatio, @@ -11,7 +11,7 @@ class PositiveButton extends StatelessWidget { this.focusNode, this.isDangerButton = false, super.key, - }) : this.buttonsAspectRatio = + }) : buttonsAspectRatio = buttonsAspectRatio ?? Dimensions.aspectRatioModalDialogButton; final String? text; diff --git a/lib/app/widgets/buttons/link_style_async_button.dart b/lib/app/widgets/buttons/link_style_async_button.dart index 40ebdab6c..1192649ad 100644 --- a/lib/app/widgets/buttons/link_style_async_button.dart +++ b/lib/app/widgets/buttons/link_style_async_button.dart @@ -5,7 +5,7 @@ class LinkStyleAsyncButton extends StatefulWidget { LinkStyleAsyncButton({ super.key, required this.text, - this.onTap = null, + this.onTap, }); final String text; diff --git a/lib/app/widgets/dialogs/dokan_different_mayor_found.dart b/lib/app/widgets/dialogs/dokan_different_mayor_found.dart index 4499b53c9..449a8858a 100644 --- a/lib/app/widgets/dialogs/dokan_different_mayor_found.dart +++ b/lib/app/widgets/dialogs/dokan_different_mayor_found.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import '../../../generated/l10n.dart'; -import '../../utils/utils.dart' - show AppThemeExtension, Dimensions, Fields, ThemeGetter; +import '../../utils/utils.dart' show AppThemeExtension, Fields, ThemeGetter; import '../widgets.dart' show NegativeButton, PositiveButton; class DokanDifferentMayorFound extends StatelessWidget { diff --git a/lib/app/widgets/dialogs/dokan_not_found.dart b/lib/app/widgets/dialogs/dokan_not_found.dart index 9131b33c6..cf1040e69 100644 --- a/lib/app/widgets/dialogs/dokan_not_found.dart +++ b/lib/app/widgets/dialogs/dokan_not_found.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import '../../../generated/l10n.dart'; -import '../../utils/utils.dart' - show AppThemeExtension, Dimensions, Fields, ThemeGetter; +import '../../utils/utils.dart' show AppThemeExtension, Fields, ThemeGetter; import '../widgets.dart' show NegativeButton, PositiveButton; class DokanNotFound extends StatelessWidget { diff --git a/lib/app/widgets/dialogs/get_password_access_dialog.dart b/lib/app/widgets/dialogs/get_password_access_dialog.dart index 3b578f0bd..004bc97ff 100644 --- a/lib/app/widgets/dialogs/get_password_access_dialog.dart +++ b/lib/app/widgets/dialogs/get_password_access_dialog.dart @@ -6,18 +6,13 @@ import '../../pages/repo_reset_access.dart'; import '../../widgets/dialogs/actions_dialog.dart'; import '../../utils/utils.dart' show - AccessModeLocalizedExtension, AppLogger, Constants, - Dialogs, Dimensions, Fields, LocalAuth, - MasterKey, Settings, validateNoEmptyMaybeRegExpr; -import '../../models/models.dart' - show AuthModeKeyStoredOnDevice, RepoLocation, SecretKeyOrigin; import '../../models/access_mode.dart'; import '../../cubits/cubits.dart' show RepoCubit; import '../widgets.dart' @@ -146,17 +141,17 @@ class _State extends State with AppLogger { final AccessMode accessMode; - if (false) { - // TODO: Find out why if we use `executefutureWithLoadingDialog` this - // dialog alwayrs returns `null`. Seems to also be related to the dialog - // using a `Form`. - accessMode = await Dialogs.executeFutureWithLoadingDialog( - context, - widget.repoCubit.getSecretAccessMode(password), - ); - } else { - accessMode = await widget.repoCubit.getSecretAccessMode(password); - } + //if (FIXME) { + // // TODO: Find out why if we use `executefutureWithLoadingDialog` this + // // dialog alwayrs returns `null`. Seems to also be related to the dialog + // // using a `Form`. + // accessMode = await Dialogs.executeFutureWithLoadingDialog( + // context, + // widget.repoCubit.getSecretAccessMode(password), + // ); + //} else { + accessMode = await widget.repoCubit.getSecretAccessMode(password); + //} Access access; diff --git a/lib/app/widgets/dialogs/modal_rename_repository_dialog.dart b/lib/app/widgets/dialogs/modal_rename_repository_dialog.dart index 14d831d33..ae965cc14 100644 --- a/lib/app/widgets/dialogs/modal_rename_repository_dialog.dart +++ b/lib/app/widgets/dialogs/modal_rename_repository_dialog.dart @@ -8,7 +8,6 @@ import '../../utils/utils.dart' show AppThemeExtension, Dialogs, - Dimensions, Fields, Strings, TextEditingControllerExtension, diff --git a/lib/app/widgets/items/list_item.dart b/lib/app/widgets/items/list_item.dart index dca9d620b..bc2c5114e 100644 --- a/lib/app/widgets/items/list_item.dart +++ b/lib/app/widgets/items/list_item.dart @@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import '../../cubits/cubits.dart'; import '../../models/models.dart'; import '../../utils/utils.dart'; -import '../repo_status.dart'; import '../widgets.dart'; class FileListItem extends StatelessWidget { diff --git a/lib/app/widgets/repo_creation.dart b/lib/app/widgets/repo_creation.dart index 538a2ee40..141ccf86e 100644 --- a/lib/app/widgets/repo_creation.dart +++ b/lib/app/widgets/repo_creation.dart @@ -15,8 +15,7 @@ import '../cubits/cubits.dart' RepoCreationValid; import '../utils/utils.dart' show AppThemeExtension, Constants, Dialogs, Dimensions, Fields, ThemeGetter; -import 'widgets.dart' - show BlocHolder, ContentWithStickyFooterState, CustomAdaptiveSwitch; +import 'widgets.dart' show ContentWithStickyFooterState, CustomAdaptiveSwitch; class RepoCreation extends StatelessWidget { RepoCreation(this.creationCubit, {super.key}); diff --git a/lib/app/widgets/selectors/access_mode_selector.dart b/lib/app/widgets/selectors/access_mode_selector.dart index 48e8d2971..4eb5b9d7d 100644 --- a/lib/app/widgets/selectors/access_mode_selector.dart +++ b/lib/app/widgets/selectors/access_mode_selector.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:ouisync/ouisync.dart'; import '../../../generated/l10n.dart'; import '../../utils/utils.dart'; diff --git a/lib/app/widgets/settings/about_section.dart b/lib/app/widgets/settings/about_section.dart index 09ad3047d..8b8c0b511 100644 --- a/lib/app/widgets/settings/about_section.dart +++ b/lib/app/widgets/settings/about_section.dart @@ -30,7 +30,6 @@ import '../../utils/utils.dart' AppThemeExtension, Constants, Dialogs, - Dimensions, dumpAll, Fields, formatSize, diff --git a/lib/app/widgets/settings/app_settings_container.dart b/lib/app/widgets/settings/app_settings_container.dart index 3c04b9efd..9f9c49fa4 100644 --- a/lib/app/widgets/settings/app_settings_container.dart +++ b/lib/app/widgets/settings/app_settings_container.dart @@ -5,7 +5,6 @@ import 'package:ouisync/ouisync.dart'; import 'package:settings_ui/settings_ui.dart' as s; import '../../cubits/cubits.dart'; -import '../../cubits/launch_at_startup.dart'; import '../../utils/platform/platform.dart'; import '../../utils/utils.dart'; import 'about_section.dart'; diff --git a/lib/app/widgets/states/locked_repository_state.dart b/lib/app/widgets/states/locked_repository_state.dart index c8a4436da..88e7dd905 100644 --- a/lib/app/widgets/states/locked_repository_state.dart +++ b/lib/app/widgets/states/locked_repository_state.dart @@ -4,7 +4,6 @@ import 'package:flutter_hooks/flutter_hooks.dart'; import '../../../generated/l10n.dart'; import '../../cubits/cubits.dart'; import '../../mixins/mixins.dart'; -import '../../utils/master_key.dart'; import '../../utils/utils.dart'; class LockedRepositoryState extends HookWidget diff --git a/ouisync b/ouisync index c594c452e..5e06b5849 160000 --- a/ouisync +++ b/ouisync @@ -1 +1 @@ -Subproject commit c594c452ee28955df99edaddc78178f3f14ce45b +Subproject commit 5e06b584950f9d6f382aaadf7ce6684bd00c4adb diff --git a/test/unit/create_repo_from_blind_token_test.dart b/test/unit/create_repo_from_blind_token_test.dart index c831af918..b7c22159c 100644 --- a/test/unit/create_repo_from_blind_token_test.dart +++ b/test/unit/create_repo_from_blind_token_test.dart @@ -1,5 +1,4 @@ import 'package:flutter_test/flutter_test.dart'; -import 'package:ouisync/ouisync.dart'; import 'package:ouisync_app/app/cubits/repo_creation.dart'; import 'package:ouisync_app/app/models/models.dart'; import 'package:ouisync_app/app/utils/share_token.dart'; diff --git a/test/unit/settings_test.dart b/test/unit/settings_test.dart index 2d81594b5..5b92010dd 100644 --- a/test/unit/settings_test.dart +++ b/test/unit/settings_test.dart @@ -4,7 +4,6 @@ import 'package:ouisync_app/app/utils/utils.dart'; import 'package:ouisync_app/app/utils/settings/v0/v0.dart' as v0; import 'package:ouisync_app/app/utils/settings/v1.dart' as v1; import 'package:ouisync_app/app/models/repo_location.dart'; -import 'package:ouisync_app/app/utils/master_key.dart'; import 'package:ouisync/ouisync.dart' show Repository, Session, SessionKind; import 'package:path_provider/path_provider.dart'; import 'package:path/path.dart'; diff --git a/test/utils.dart b/test/utils.dart index 0a8ef59a5..1d1f25541 100644 --- a/test/utils.dart +++ b/test/utils.dart @@ -27,7 +27,6 @@ import 'package:path_provider_platform_interface/path_provider_platform_interfac import 'package:receive_sharing_intent/receive_sharing_intent.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:stack_trace/stack_trace.dart'; -import 'dart:typed_data' show ByteData, Uint8List; /// Setup the test environment and run `callback` inside it. /// @@ -379,7 +378,7 @@ extension WidgetTesterExtension on WidgetTester { // A workaround for the issue with pumpAndSettle as described here // https://stackoverflow.com/questions/67186472/error-pumpandsettle-timed-out-maybe-due-to-riverpod Future pumpUntilFound(Finder finder, - {Duration? timeout = null, Duration? pumpTime = null}) async { + {Duration? timeout, Duration? pumpTime}) async { final found = await pumpUntilNonNull( () => finder.tryEvaluate() ? finder : null, timeout: timeout, @@ -392,14 +391,14 @@ extension WidgetTesterExtension on WidgetTester { } Future pumpUntil(bool Function() predicate, - {Duration? timeout = null, Duration? pumpTime = null}) async { + {Duration? timeout, Duration? pumpTime}) async { await pumpUntilNonNull(() => predicate() ? true : null, timeout: timeout, pumpTime: pumpTime); return; } Future pumpUntilNonNull(T? Function() f, - {Duration? timeout = null, Duration? pumpTime = null}) async { + {Duration? timeout, Duration? pumpTime}) async { timeout ??= Duration(seconds: 5); pumpTime ??= Duration(milliseconds: 100); diff --git a/test/widget/navigation.dart b/test/widget/navigation.dart index d39572a6f..b3d0a3de2 100644 --- a/test/widget/navigation.dart +++ b/test/widget/navigation.dart @@ -2,9 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:ouisync_app/app/cubits/repo.dart'; import 'package:ouisync_app/app/cubits/repo_creation.dart'; -import 'package:ouisync_app/app/models/auth_mode.dart'; -import 'package:ouisync_app/app/models/repo_location.dart'; -import 'package:ouisync_app/app/models/repo_entry.dart'; import 'package:ouisync_app/app/pages/repo_security_page.dart'; import 'package:ouisync_app/app/pages/repo_reset_access.dart'; import 'package:ouisync_app/app/utils/utils.dart'; diff --git a/test/widget/repo_creation_test.dart b/test/widget/repo_creation_test.dart index 33ca24938..929cfe789 100644 --- a/test/widget/repo_creation_test.dart +++ b/test/widget/repo_creation_test.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:ouisync_app/app/cubits/repo_creation.dart'; import 'package:ouisync_app/app/models/auth_mode.dart'; -import 'package:ouisync_app/app/models/local_secret.dart'; import 'package:ouisync_app/app/models/repo_location.dart'; import 'package:ouisync_app/app/utils/share_token.dart'; import 'package:ouisync/ouisync.dart' diff --git a/test/widget/repo_security_test.dart b/test/widget/repo_security_test.dart index 7badfb06d..a4eed978d 100644 --- a/test/widget/repo_security_test.dart +++ b/test/widget/repo_security_test.dart @@ -105,7 +105,7 @@ void main() { await tester.pumpAndSettle(); // Tap that we don't want the password to be stored. - return tester.tap(find.descendant( + await tester.tap(find.descendant( of: find.byKey(Key('store-on-device')), matching: find.byType(Switch))); diff --git a/test/widget/unlock_test.dart b/test/widget/unlock_test.dart index 16d136828..3bf30690d 100644 --- a/test/widget/unlock_test.dart +++ b/test/widget/unlock_test.dart @@ -75,7 +75,6 @@ void main() { final repoPage = await mainPage.createAndEnterRepository(); final blindToken = await repoPage.createBlindToken(); - final writeToken = await repoPage.createWriteToken(); // The repo is in write mode, tapping this button will lock it. await repoPage.tapAccessModeButton();