From 52280062601604e1b622bad5b52e52a60dbf13ae Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 3 Sep 2023 11:50:53 +0200 Subject: [PATCH] chore(dynamite,dynamite_runtime,neon,neon_files): Fix typos Signed-off-by: jld3103 --- .../lib/src/type_result/type_result.dart | 2 +- .../dynamite_runtime/lib/src/uri.dart | 2 +- .../neon/lib/src/bloc/result_builder.dart | 2 +- .../lib/src/models/app_implementation.dart | 4 +-- .../neon/neon/lib/src/pages/settings.dart | 20 +++++------ packages/neon/neon/lib/src/router.dart | 4 +-- packages/neon/neon/lib/src/router.g.dart | 22 ++++++------ .../settings/models/options_collection.dart | 2 +- .../neon/lib/src/settings/models/storage.dart | 2 +- .../neon/lib/src/utils/global_popups.dart | 2 +- .../neon/neon/lib/src/utils/hex_color.dart | 4 +-- .../src/widgets/account_switcher_button.dart | 2 +- .../neon/neon/test/settings_export_test.dart | 8 ++--- packages/neon/neon/test/storage_test.dart | 34 +++++++++---------- packages/neon/neon_files/lib/blocs/files.dart | 12 +++---- .../neon_files/lib/widgets/browser_view.dart | 2 +- 16 files changed, 62 insertions(+), 62 deletions(-) diff --git a/packages/dynamite/dynamite/lib/src/type_result/type_result.dart b/packages/dynamite/dynamite/lib/src/type_result/type_result.dart index 89119592..7067ddfc 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/type_result.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/type_result.dart @@ -13,7 +13,7 @@ abstract class TypeResult { this.className, { this.generics = const [], this.nullable = false, - }) : assert(!className.contains('<'), 'Specifiy generics in the generics parameter.'), + }) : assert(!className.contains('<'), 'Specify generics in the generics parameter.'), assert(!className.contains('?'), 'Nullability should not be specified in the type.'); final String className; diff --git a/packages/dynamite/dynamite_runtime/lib/src/uri.dart b/packages/dynamite/dynamite_runtime/lib/src/uri.dart index 61e5bf5d..11dd9ba9 100644 --- a/packages/dynamite/dynamite_runtime/lib/src/uri.dart +++ b/packages/dynamite/dynamite_runtime/lib/src/uri.dart @@ -3,7 +3,7 @@ /// This might evolve into a separate class implementing the [Uri] interface in the future. /// extension UriExtension on Uri { - /// Similar to [normalizePath] but it will also remove exmpty [pathSegments]. + /// Similar to [normalizePath] but it will also remove empty [pathSegments]. Uri normalizeEmptyPath() { final normalized = normalizePath(); if (normalized.path.endsWith('/')) { diff --git a/packages/neon/neon/lib/src/bloc/result_builder.dart b/packages/neon/neon/lib/src/bloc/result_builder.dart index f4a7ef61..2d7f4cf8 100644 --- a/packages/neon/neon/lib/src/bloc/result_builder.dart +++ b/packages/neon/neon/lib/src/bloc/result_builder.dart @@ -26,7 +26,7 @@ class ResultBuilder extends StreamBuilderBase, Result> { @override Result afterData(final Result current, final Result data) { - // prevent rebuild when only the cache state cahnges + // prevent rebuild when only the cache state changes if (current == data) { return current; } diff --git a/packages/neon/neon/lib/src/models/app_implementation.dart b/packages/neon/neon/lib/src/models/app_implementation.dart index 4c50508c..b8f184ed 100644 --- a/packages/neon/neon/lib/src/models/app_implementation.dart +++ b/packages/neon/neon/lib/src/models/app_implementation.dart @@ -74,7 +74,7 @@ abstract class AppImplementation /// Route for the app. /// /// All pages of the app must be specified as subroutes. - /// If this is not [GoRoute] an inital route name must be specified by overriding [initialRouteName]. + /// If this is not [GoRoute] an initial route name must be specified by overriding [initialRouteName]. RouteBase get route; /// Name of the initial route for this app. @@ -114,7 +114,7 @@ abstract class AppImplementation /// A custom theme that will be injected into the widget tree. /// - /// You can later acess it through `Theme.of(context).extension()`. + /// You can later access it through `Theme.of(context).extension()`. final ThemeExtension? theme = null; } diff --git a/packages/neon/neon/lib/src/pages/settings.dart b/packages/neon/neon/lib/src/pages/settings.dart index a1e2bd70..63188e4f 100644 --- a/packages/neon/neon/lib/src/pages/settings.dart +++ b/packages/neon/neon/lib/src/pages/settings.dart @@ -25,7 +25,7 @@ import 'package:neon/src/widgets/exception.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:provider/provider.dart'; -enum SettingsCageories { +enum SettingsCategories { apps, theme, navigation, @@ -42,7 +42,7 @@ class SettingsPage extends StatefulWidget { super.key, }); - final SettingsCageories? initialCategory; + final SettingsCategories? initialCategory; @override State createState() => _SettingsPageState(); @@ -96,7 +96,7 @@ class _SettingsPageState extends State { categories: [ SettingsCategory( title: Text(AppLocalizations.of(context).settingsApps), - key: ValueKey(SettingsCageories.apps.name), + key: ValueKey(SettingsCategories.apps.name), tiles: [ for (final appImplementation in appImplementations) ...[ if (appImplementation.options.options.isNotEmpty) ...[ @@ -113,7 +113,7 @@ class _SettingsPageState extends State { ), SettingsCategory( title: Text(AppLocalizations.of(context).optionsCategoryTheme), - key: ValueKey(SettingsCageories.theme.name), + key: ValueKey(SettingsCategories.theme.name), tiles: [ DropdownButtonSettingsTile( option: globalOptions.themeMode, @@ -128,7 +128,7 @@ class _SettingsPageState extends State { ), SettingsCategory( title: Text(AppLocalizations.of(context).optionsCategoryNavigation), - key: ValueKey(SettingsCageories.navigation.name), + key: ValueKey(SettingsCategories.navigation.name), tiles: [ DropdownButtonSettingsTile( option: globalOptions.navigationMode, @@ -138,7 +138,7 @@ class _SettingsPageState extends State { if (NeonPlatform.instance.canUsePushNotifications) ...[ SettingsCategory( title: Text(AppLocalizations.of(context).optionsCategoryPushNotifications), - key: ValueKey(SettingsCageories.pushNotifications.name), + key: ValueKey(SettingsCategories.pushNotifications.name), tiles: [ if (!globalOptions.pushNotificationsEnabled.enabled) ...[ TextSettingsTile( @@ -162,7 +162,7 @@ class _SettingsPageState extends State { if (NeonPlatform.instance.canUseWindowManager) ...[ SettingsCategory( title: Text(AppLocalizations.of(context).optionsCategoryStartup), - key: ValueKey(SettingsCageories.startup.name), + key: ValueKey(SettingsCategories.startup.name), tiles: [ CheckBoxSettingsTile( option: globalOptions.startupMinimized, @@ -176,7 +176,7 @@ class _SettingsPageState extends State { if (NeonPlatform.instance.canUseWindowManager && NeonPlatform.instance.canUseSystemTray) ...[ SettingsCategory( title: Text(AppLocalizations.of(context).optionsCategorySystemTray), - key: ValueKey(SettingsCageories.systemTray.name), + key: ValueKey(SettingsCategories.systemTray.name), tiles: [ CheckBoxSettingsTile( option: globalOptions.systemTrayEnabled, @@ -189,7 +189,7 @@ class _SettingsPageState extends State { ], SettingsCategory( title: Text(AppLocalizations.of(context).optionsCategoryAccounts), - key: ValueKey(SettingsCageories.accounts.name), + key: ValueKey(SettingsCategories.accounts.name), tiles: [ if (accountsSnapshot.requireData.length > 1) ...[ CheckBoxSettingsTile( @@ -218,7 +218,7 @@ class _SettingsPageState extends State { ), SettingsCategory( title: Text(AppLocalizations.of(context).optionsCategoryOther), - key: ValueKey(SettingsCageories.other.name), + key: ValueKey(SettingsCategories.other.name), tiles: [ CustomSettingsTile( leading: Icon( diff --git a/packages/neon/neon/lib/src/router.dart b/packages/neon/neon/lib/src/router.dart index 19a5016a..38290042 100644 --- a/packages/neon/neon/lib/src/router.dart +++ b/packages/neon/neon/lib/src/router.dart @@ -52,7 +52,7 @@ class AppRouter extends GoRouter { } } - // redirect to loginscreen when no account is logged in + // redirect to login screen when no account is logged in if (!accountsBloc.hasAccounts && !state.uri.toString().startsWith(const LoginRoute().location)) { return const LoginRoute().location; } @@ -387,7 +387,7 @@ class SettingsRoute extends GoRouteData { const SettingsRoute({this.initialCategory}); /// The initial category to show. - final SettingsCageories? initialCategory; + final SettingsCategories? initialCategory; @override Widget build(final BuildContext context, final GoRouterState state) => SettingsPage(initialCategory: initialCategory); diff --git a/packages/neon/neon/lib/src/router.g.dart b/packages/neon/neon/lib/src/router.g.dart index b9fdc4da..04304861 100644 --- a/packages/neon/neon/lib/src/router.g.dart +++ b/packages/neon/neon/lib/src/router.g.dart @@ -78,13 +78,13 @@ extension $HomeRouteExtension on HomeRoute { extension $SettingsRouteExtension on SettingsRoute { static SettingsRoute _fromState(GoRouterState state) => SettingsRoute( initialCategory: - _$convertMapValue('initial-category', state.uri.queryParameters, _$SettingsCageoriesEnumMap._$fromName), + _$convertMapValue('initial-category', state.uri.queryParameters, _$SettingsCategoriesEnumMap._$fromName), ); String get location => GoRouteData.$location( '/settings', queryParams: { - if (initialCategory != null) 'initial-category': _$SettingsCageoriesEnumMap[initialCategory!], + if (initialCategory != null) 'initial-category': _$SettingsCategoriesEnumMap[initialCategory!], }, ); @@ -97,15 +97,15 @@ extension $SettingsRouteExtension on SettingsRoute { void replace(BuildContext context) => context.replace(location); } -const _$SettingsCageoriesEnumMap = { - SettingsCageories.apps: 'apps', - SettingsCageories.theme: 'theme', - SettingsCageories.navigation: 'navigation', - SettingsCageories.pushNotifications: 'push-notifications', - SettingsCageories.startup: 'startup', - SettingsCageories.systemTray: 'system-tray', - SettingsCageories.accounts: 'accounts', - SettingsCageories.other: 'other', +const _$SettingsCategoriesEnumMap = { + SettingsCategories.apps: 'apps', + SettingsCategories.theme: 'theme', + SettingsCategories.navigation: 'navigation', + SettingsCategories.pushNotifications: 'push-notifications', + SettingsCategories.startup: 'startup', + SettingsCategories.systemTray: 'system-tray', + SettingsCategories.accounts: 'accounts', + SettingsCategories.other: 'other', }; extension $NextcloudAppSettingsRouteExtension on NextcloudAppSettingsRoute { diff --git a/packages/neon/neon/lib/src/settings/models/options_collection.dart b/packages/neon/neon/lib/src/settings/models/options_collection.dart index d81acc2c..59e5b4a6 100644 --- a/packages/neon/neon/lib/src/settings/models/options_collection.dart +++ b/packages/neon/neon/lib/src/settings/models/options_collection.dart @@ -53,7 +53,7 @@ abstract class OptionsCollection implements Exportable { } } -/// OpptionsCollection for a neon app. +/// OptionsCollection for a neon app. abstract class NextcloudAppOptions extends OptionsCollection { NextcloudAppOptions(super.storage); diff --git a/packages/neon/neon/lib/src/settings/models/storage.dart b/packages/neon/neon/lib/src/settings/models/storage.dart index df865c61..409ea3ff 100644 --- a/packages/neon/neon/lib/src/settings/models/storage.dart +++ b/packages/neon/neon/lib/src/settings/models/storage.dart @@ -41,7 +41,7 @@ final class NeonStorage { /// Shared preferences instance. /// /// Use [database] to access it. - /// Make sure it has been initialized wiht [init] before. + /// Make sure it has been initialized with [init] before. static SharedPreferences? _sharedPreferences; @visibleForTesting diff --git a/packages/neon/neon/lib/src/utils/global_popups.dart b/packages/neon/neon/lib/src/utils/global_popups.dart index b0d83022..2cb8d377 100644 --- a/packages/neon/neon/lib/src/utils/global_popups.dart +++ b/packages/neon/neon/lib/src/utils/global_popups.dart @@ -60,7 +60,7 @@ class GlobalPopups { action: SnackBarAction( label: AppLocalizations.of(_context).settings, onPressed: () { - const SettingsRoute(initialCategory: SettingsCageories.pushNotifications).go(_context); + const SettingsRoute(initialCategory: SettingsCategories.pushNotifications).go(_context); }, ), ), diff --git a/packages/neon/neon/lib/src/utils/hex_color.dart b/packages/neon/neon/lib/src/utils/hex_color.dart index ca488c70..4ac99468 100644 --- a/packages/neon/neon/lib/src/utils/hex_color.dart +++ b/packages/neon/neon/lib/src/utils/hex_color.dart @@ -4,8 +4,8 @@ class HexColor extends Color { HexColor(final String hexColor) : super(_parse(hexColor)); static int _parse(final String hexColor) { - final formated = hexColor.toUpperCase().replaceAll('#', '').padLeft(8, 'F'); + final formatted = hexColor.toUpperCase().replaceAll('#', '').padLeft(8, 'F'); - return int.parse(formated, radix: 16); + return int.parse(formatted, radix: 16); } } diff --git a/packages/neon/neon/lib/src/widgets/account_switcher_button.dart b/packages/neon/neon/lib/src/widgets/account_switcher_button.dart index 36e69452..bc5db8a3 100644 --- a/packages/neon/neon/lib/src/widgets/account_switcher_button.dart +++ b/packages/neon/neon/lib/src/widgets/account_switcher_button.dart @@ -28,7 +28,7 @@ class AccountSwitcherButton extends StatelessWidget { title: Text(AppLocalizations.of(context).settingsAccountManage), onTap: () { Navigator.of(context).pop(); - const SettingsRoute(initialCategory: SettingsCageories.accounts).push(context); + const SettingsRoute(initialCategory: SettingsCategories.accounts).push(context); }, ), ], diff --git a/packages/neon/neon/test/settings_export_test.dart b/packages/neon/neon/test/settings_export_test.dart index 69800787..3eedb039 100644 --- a/packages/neon/neon/test/settings_export_test.dart +++ b/packages/neon/neon/test/settings_export_test.dart @@ -92,8 +92,8 @@ void main() { }, ); - const value = MapEntry('sxportableKey', 'value'); - const export = {'sxportableKey': 'value'}; + const value = MapEntry('exportableKey', 'value'); + const export = {'exportableKey': 'value'}; when(exportable.export).thenAnswer((final _) => value); @@ -111,8 +111,8 @@ void main() { }, ); - const value = MapEntry('sxportableKey', 'value'); - const jsonExport = {'sxportableKey': 'value'}; + const value = MapEntry('exportableKey', 'value'); + const jsonExport = {'exportableKey': 'value'}; final export = JsonUtf8Encoder().convert(jsonExport) as Uint8List; when(exportable.export).thenAnswer((final _) => value); diff --git a/packages/neon/neon/test/storage_test.dart b/packages/neon/neon/test/storage_test.dart index 6fe101b4..b50376d9 100644 --- a/packages/neon/neon/test/storage_test.dart +++ b/packages/neon/neon/test/storage_test.dart @@ -33,48 +33,48 @@ void main() { NeonStorage.mock(sharedPreferences); const appStorage = AppStorage(StorageKeys.accounts); const key = 'key'; - final formatedKey = appStorage.formatKey(key); + final formattedKey = appStorage.formatKey(key); - when(() => sharedPreferences.containsKey(formatedKey)).thenReturn(true); + when(() => sharedPreferences.containsKey(formattedKey)).thenReturn(true); dynamic result = appStorage.containsKey(key); expect(result, equals(true)); - verify(() => sharedPreferences.containsKey(formatedKey)).called(1); + verify(() => sharedPreferences.containsKey(formattedKey)).called(1); - when(() => sharedPreferences.remove(formatedKey)).thenAnswer((final _) => Future.value(false)); + when(() => sharedPreferences.remove(formattedKey)).thenAnswer((final _) => Future.value(false)); result = await appStorage.remove(key); expect(result, equals(false)); - verify(() => sharedPreferences.remove(formatedKey)).called(1); + verify(() => sharedPreferences.remove(formattedKey)).called(1); - when(() => sharedPreferences.getString(formatedKey)).thenReturn(null); + when(() => sharedPreferences.getString(formattedKey)).thenReturn(null); result = appStorage.getString(key); expect(result, isNull); - verify(() => sharedPreferences.getString(formatedKey)).called(1); + verify(() => sharedPreferences.getString(formattedKey)).called(1); - when(() => sharedPreferences.setString(formatedKey, 'value')).thenAnswer((final _) => Future.value(false)); + when(() => sharedPreferences.setString(formattedKey, 'value')).thenAnswer((final _) => Future.value(false)); result = await appStorage.setString(key, 'value'); expect(result, false); - verify(() => sharedPreferences.setString(formatedKey, 'value')).called(1); + verify(() => sharedPreferences.setString(formattedKey, 'value')).called(1); - when(() => sharedPreferences.getBool(formatedKey)).thenReturn(true); + when(() => sharedPreferences.getBool(formattedKey)).thenReturn(true); result = appStorage.getBool(key); expect(result, equals(true)); - verify(() => sharedPreferences.getBool(formatedKey)).called(1); + verify(() => sharedPreferences.getBool(formattedKey)).called(1); - when(() => sharedPreferences.setBool(formatedKey, true)).thenAnswer((final _) => Future.value(true)); + when(() => sharedPreferences.setBool(formattedKey, true)).thenAnswer((final _) => Future.value(true)); result = await appStorage.setBool(key, true); expect(result, true); - verify(() => sharedPreferences.setBool(formatedKey, true)).called(1); + verify(() => sharedPreferences.setBool(formattedKey, true)).called(1); - when(() => sharedPreferences.getStringList(formatedKey)).thenReturn(['hi there']); + when(() => sharedPreferences.getStringList(formattedKey)).thenReturn(['hi there']); result = appStorage.getStringList(key); expect(result, equals(['hi there'])); - verify(() => sharedPreferences.getStringList(formatedKey)).called(1); + verify(() => sharedPreferences.getStringList(formattedKey)).called(1); - when(() => sharedPreferences.setStringList(formatedKey, ['hi there'])) + when(() => sharedPreferences.setStringList(formattedKey, ['hi there'])) .thenAnswer((final _) => Future.value(false)); result = await appStorage.setStringList(key, ['hi there']); expect(result, false); - verify(() => sharedPreferences.setStringList(formatedKey, ['hi there'])).called(1); + verify(() => sharedPreferences.setStringList(formattedKey, ['hi there'])).called(1); }); }); diff --git a/packages/neon/neon_files/lib/blocs/files.dart b/packages/neon/neon_files/lib/blocs/files.dart index 4ec1c7cd..608b82ec 100644 --- a/packages/neon/neon_files/lib/blocs/files.dart +++ b/packages/neon/neon_files/lib/blocs/files.dart @@ -29,8 +29,8 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta this.options, this.account, ) { - options.uploadQueueParallelism.addListener(_uploadParalelismListener); - options.downloadQueueParallelism.addListener(_downloadParalelismListener); + options.uploadQueueParallelism.addListener(_uploadParallelismListener); + options.downloadQueueParallelism.addListener(_downloadParallelismListener); } final FilesAppSpecificOptions options; @@ -46,8 +46,8 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta _downloadQueue.dispose(); unawaited(tasks.close()); - options.uploadQueueParallelism.removeListener(_uploadParalelismListener); - options.downloadQueueParallelism.removeListener(_downloadParalelismListener); + options.uploadQueueParallelism.removeListener(_uploadParallelismListener); + options.downloadQueueParallelism.removeListener(_downloadParallelismListener); } @override @@ -177,11 +177,11 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta FilesBrowserBloc getNewFilesBrowserBloc() => FilesBrowserBloc(options, account); - void _downloadParalelismListener() { + void _downloadParallelismListener() { _downloadQueue.parallel = options.downloadQueueParallelism.value; } - void _uploadParalelismListener() { + void _uploadParallelismListener() { _uploadQueue.parallel = options.uploadQueueParallelism.value; } } diff --git a/packages/neon/neon_files/lib/widgets/browser_view.dart b/packages/neon/neon_files/lib/widgets/browser_view.dart index c0daa200..fe2ef75e 100644 --- a/packages/neon/neon_files/lib/widgets/browser_view.dart +++ b/packages/neon/neon_files/lib/widgets/browser_view.dart @@ -4,7 +4,7 @@ part of '../neon_files.dart'; enum FilesBrowserMode { /// Default file browser mode. /// - /// When a file is selecteed it will be opened or downloaded. + /// When a file is selected it will be opened or downloaded. browser, /// Select directory.