Browse Source

chore(dynamite,dynamite_runtime,neon,neon_files): Fix typos

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/703/head
jld3103 1 year ago
parent
commit
5228006260
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 2
      packages/dynamite/dynamite/lib/src/type_result/type_result.dart
  2. 2
      packages/dynamite/dynamite_runtime/lib/src/uri.dart
  3. 2
      packages/neon/neon/lib/src/bloc/result_builder.dart
  4. 4
      packages/neon/neon/lib/src/models/app_implementation.dart
  5. 20
      packages/neon/neon/lib/src/pages/settings.dart
  6. 2
      packages/neon/neon/lib/src/router.dart
  7. 22
      packages/neon/neon/lib/src/router.g.dart
  8. 2
      packages/neon/neon/lib/src/settings/models/options_collection.dart
  9. 2
      packages/neon/neon/lib/src/settings/models/storage.dart
  10. 2
      packages/neon/neon/lib/src/utils/global_popups.dart
  11. 4
      packages/neon/neon/lib/src/utils/hex_color.dart
  12. 2
      packages/neon/neon/lib/src/widgets/account_switcher_button.dart
  13. 8
      packages/neon/neon/test/settings_export_test.dart
  14. 34
      packages/neon/neon/test/storage_test.dart
  15. 12
      packages/neon/neon_files/lib/blocs/files.dart
  16. 2
      packages/neon/neon_files/lib/widgets/browser_view.dart

2
packages/dynamite/dynamite/lib/src/type_result/type_result.dart

@ -13,7 +13,7 @@ abstract class TypeResult {
this.className, { this.className, {
this.generics = const [], this.generics = const [],
this.nullable = false, 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.'); assert(!className.contains('?'), 'Nullability should not be specified in the type.');
final String className; final String className;

2
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. /// This might evolve into a separate class implementing the [Uri] interface in the future.
/// ///
extension UriExtension on Uri { 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() { Uri normalizeEmptyPath() {
final normalized = normalizePath(); final normalized = normalizePath();
if (normalized.path.endsWith('/')) { if (normalized.path.endsWith('/')) {

2
packages/neon/neon/lib/src/bloc/result_builder.dart

@ -26,7 +26,7 @@ class ResultBuilder<T> extends StreamBuilderBase<Result<T>, Result<T>> {
@override @override
Result<T> afterData(final Result<T> current, final Result<T> data) { Result<T> afterData(final Result<T> current, final Result<T> data) {
// prevent rebuild when only the cache state cahnges // prevent rebuild when only the cache state changes
if (current == data) { if (current == data) {
return current; return current;
} }

4
packages/neon/neon/lib/src/models/app_implementation.dart

@ -74,7 +74,7 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppOptions>
/// Route for the app. /// Route for the app.
/// ///
/// All pages of the app must be specified as subroutes. /// 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; RouteBase get route;
/// Name of the initial route for this app. /// Name of the initial route for this app.
@ -114,7 +114,7 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppOptions>
/// A custom theme that will be injected into the widget tree. /// A custom theme that will be injected into the widget tree.
/// ///
/// You can later acess it through `Theme.of(context).extension<ThemeName>()`. /// You can later access it through `Theme.of(context).extension<ThemeName>()`.
final ThemeExtension? theme = null; final ThemeExtension? theme = null;
} }

20
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:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
enum SettingsCageories { enum SettingsCategories {
apps, apps,
theme, theme,
navigation, navigation,
@ -42,7 +42,7 @@ class SettingsPage extends StatefulWidget {
super.key, super.key,
}); });
final SettingsCageories? initialCategory; final SettingsCategories? initialCategory;
@override @override
State<SettingsPage> createState() => _SettingsPageState(); State<SettingsPage> createState() => _SettingsPageState();
@ -96,7 +96,7 @@ class _SettingsPageState extends State<SettingsPage> {
categories: [ categories: [
SettingsCategory( SettingsCategory(
title: Text(AppLocalizations.of(context).settingsApps), title: Text(AppLocalizations.of(context).settingsApps),
key: ValueKey(SettingsCageories.apps.name), key: ValueKey(SettingsCategories.apps.name),
tiles: <SettingsTile>[ tiles: <SettingsTile>[
for (final appImplementation in appImplementations) ...[ for (final appImplementation in appImplementations) ...[
if (appImplementation.options.options.isNotEmpty) ...[ if (appImplementation.options.options.isNotEmpty) ...[
@ -113,7 +113,7 @@ class _SettingsPageState extends State<SettingsPage> {
), ),
SettingsCategory( SettingsCategory(
title: Text(AppLocalizations.of(context).optionsCategoryTheme), title: Text(AppLocalizations.of(context).optionsCategoryTheme),
key: ValueKey(SettingsCageories.theme.name), key: ValueKey(SettingsCategories.theme.name),
tiles: [ tiles: [
DropdownButtonSettingsTile( DropdownButtonSettingsTile(
option: globalOptions.themeMode, option: globalOptions.themeMode,
@ -128,7 +128,7 @@ class _SettingsPageState extends State<SettingsPage> {
), ),
SettingsCategory( SettingsCategory(
title: Text(AppLocalizations.of(context).optionsCategoryNavigation), title: Text(AppLocalizations.of(context).optionsCategoryNavigation),
key: ValueKey(SettingsCageories.navigation.name), key: ValueKey(SettingsCategories.navigation.name),
tiles: [ tiles: [
DropdownButtonSettingsTile( DropdownButtonSettingsTile(
option: globalOptions.navigationMode, option: globalOptions.navigationMode,
@ -138,7 +138,7 @@ class _SettingsPageState extends State<SettingsPage> {
if (NeonPlatform.instance.canUsePushNotifications) ...[ if (NeonPlatform.instance.canUsePushNotifications) ...[
SettingsCategory( SettingsCategory(
title: Text(AppLocalizations.of(context).optionsCategoryPushNotifications), title: Text(AppLocalizations.of(context).optionsCategoryPushNotifications),
key: ValueKey(SettingsCageories.pushNotifications.name), key: ValueKey(SettingsCategories.pushNotifications.name),
tiles: [ tiles: [
if (!globalOptions.pushNotificationsEnabled.enabled) ...[ if (!globalOptions.pushNotificationsEnabled.enabled) ...[
TextSettingsTile( TextSettingsTile(
@ -162,7 +162,7 @@ class _SettingsPageState extends State<SettingsPage> {
if (NeonPlatform.instance.canUseWindowManager) ...[ if (NeonPlatform.instance.canUseWindowManager) ...[
SettingsCategory( SettingsCategory(
title: Text(AppLocalizations.of(context).optionsCategoryStartup), title: Text(AppLocalizations.of(context).optionsCategoryStartup),
key: ValueKey(SettingsCageories.startup.name), key: ValueKey(SettingsCategories.startup.name),
tiles: [ tiles: [
CheckBoxSettingsTile( CheckBoxSettingsTile(
option: globalOptions.startupMinimized, option: globalOptions.startupMinimized,
@ -176,7 +176,7 @@ class _SettingsPageState extends State<SettingsPage> {
if (NeonPlatform.instance.canUseWindowManager && NeonPlatform.instance.canUseSystemTray) ...[ if (NeonPlatform.instance.canUseWindowManager && NeonPlatform.instance.canUseSystemTray) ...[
SettingsCategory( SettingsCategory(
title: Text(AppLocalizations.of(context).optionsCategorySystemTray), title: Text(AppLocalizations.of(context).optionsCategorySystemTray),
key: ValueKey(SettingsCageories.systemTray.name), key: ValueKey(SettingsCategories.systemTray.name),
tiles: [ tiles: [
CheckBoxSettingsTile( CheckBoxSettingsTile(
option: globalOptions.systemTrayEnabled, option: globalOptions.systemTrayEnabled,
@ -189,7 +189,7 @@ class _SettingsPageState extends State<SettingsPage> {
], ],
SettingsCategory( SettingsCategory(
title: Text(AppLocalizations.of(context).optionsCategoryAccounts), title: Text(AppLocalizations.of(context).optionsCategoryAccounts),
key: ValueKey(SettingsCageories.accounts.name), key: ValueKey(SettingsCategories.accounts.name),
tiles: [ tiles: [
if (accountsSnapshot.requireData.length > 1) ...[ if (accountsSnapshot.requireData.length > 1) ...[
CheckBoxSettingsTile( CheckBoxSettingsTile(
@ -218,7 +218,7 @@ class _SettingsPageState extends State<SettingsPage> {
), ),
SettingsCategory( SettingsCategory(
title: Text(AppLocalizations.of(context).optionsCategoryOther), title: Text(AppLocalizations.of(context).optionsCategoryOther),
key: ValueKey(SettingsCageories.other.name), key: ValueKey(SettingsCategories.other.name),
tiles: <SettingsTile>[ tiles: <SettingsTile>[
CustomSettingsTile( CustomSettingsTile(
leading: Icon( leading: Icon(

2
packages/neon/neon/lib/src/router.dart

@ -387,7 +387,7 @@ class SettingsRoute extends GoRouteData {
const SettingsRoute({this.initialCategory}); const SettingsRoute({this.initialCategory});
/// The initial category to show. /// The initial category to show.
final SettingsCageories? initialCategory; final SettingsCategories? initialCategory;
@override @override
Widget build(final BuildContext context, final GoRouterState state) => SettingsPage(initialCategory: initialCategory); Widget build(final BuildContext context, final GoRouterState state) => SettingsPage(initialCategory: initialCategory);

22
packages/neon/neon/lib/src/router.g.dart

@ -78,13 +78,13 @@ extension $HomeRouteExtension on HomeRoute {
extension $SettingsRouteExtension on SettingsRoute { extension $SettingsRouteExtension on SettingsRoute {
static SettingsRoute _fromState(GoRouterState state) => SettingsRoute( static SettingsRoute _fromState(GoRouterState state) => SettingsRoute(
initialCategory: initialCategory:
_$convertMapValue('initial-category', state.uri.queryParameters, _$SettingsCageoriesEnumMap._$fromName), _$convertMapValue('initial-category', state.uri.queryParameters, _$SettingsCategoriesEnumMap._$fromName),
); );
String get location => GoRouteData.$location( String get location => GoRouteData.$location(
'/settings', '/settings',
queryParams: { 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); void replace(BuildContext context) => context.replace(location);
} }
const _$SettingsCageoriesEnumMap = { const _$SettingsCategoriesEnumMap = {
SettingsCageories.apps: 'apps', SettingsCategories.apps: 'apps',
SettingsCageories.theme: 'theme', SettingsCategories.theme: 'theme',
SettingsCageories.navigation: 'navigation', SettingsCategories.navigation: 'navigation',
SettingsCageories.pushNotifications: 'push-notifications', SettingsCategories.pushNotifications: 'push-notifications',
SettingsCageories.startup: 'startup', SettingsCategories.startup: 'startup',
SettingsCageories.systemTray: 'system-tray', SettingsCategories.systemTray: 'system-tray',
SettingsCageories.accounts: 'accounts', SettingsCategories.accounts: 'accounts',
SettingsCageories.other: 'other', SettingsCategories.other: 'other',
}; };
extension $NextcloudAppSettingsRouteExtension on NextcloudAppSettingsRoute { extension $NextcloudAppSettingsRouteExtension on NextcloudAppSettingsRoute {

2
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 { abstract class NextcloudAppOptions extends OptionsCollection {
NextcloudAppOptions(super.storage); NextcloudAppOptions(super.storage);

2
packages/neon/neon/lib/src/settings/models/storage.dart

@ -41,7 +41,7 @@ final class NeonStorage {
/// Shared preferences instance. /// Shared preferences instance.
/// ///
/// Use [database] to access it. /// 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; static SharedPreferences? _sharedPreferences;
@visibleForTesting @visibleForTesting

2
packages/neon/neon/lib/src/utils/global_popups.dart

@ -60,7 +60,7 @@ class GlobalPopups {
action: SnackBarAction( action: SnackBarAction(
label: AppLocalizations.of(_context).settings, label: AppLocalizations.of(_context).settings,
onPressed: () { onPressed: () {
const SettingsRoute(initialCategory: SettingsCageories.pushNotifications).go(_context); const SettingsRoute(initialCategory: SettingsCategories.pushNotifications).go(_context);
}, },
), ),
), ),

4
packages/neon/neon/lib/src/utils/hex_color.dart

@ -4,8 +4,8 @@ class HexColor extends Color {
HexColor(final String hexColor) : super(_parse(hexColor)); HexColor(final String hexColor) : super(_parse(hexColor));
static int _parse(final String 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);
} }
} }

2
packages/neon/neon/lib/src/widgets/account_switcher_button.dart

@ -28,7 +28,7 @@ class AccountSwitcherButton extends StatelessWidget {
title: Text(AppLocalizations.of(context).settingsAccountManage), title: Text(AppLocalizations.of(context).settingsAccountManage),
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
const SettingsRoute(initialCategory: SettingsCageories.accounts).push(context); const SettingsRoute(initialCategory: SettingsCategories.accounts).push(context);
}, },
), ),
], ],

8
packages/neon/neon/test/settings_export_test.dart

@ -92,8 +92,8 @@ void main() {
}, },
); );
const value = MapEntry('sxportableKey', 'value'); const value = MapEntry('exportableKey', 'value');
const export = {'sxportableKey': 'value'}; const export = {'exportableKey': 'value'};
when(exportable.export).thenAnswer((final _) => value); when(exportable.export).thenAnswer((final _) => value);
@ -111,8 +111,8 @@ void main() {
}, },
); );
const value = MapEntry('sxportableKey', 'value'); const value = MapEntry('exportableKey', 'value');
const jsonExport = {'sxportableKey': 'value'}; const jsonExport = {'exportableKey': 'value'};
final export = JsonUtf8Encoder().convert(jsonExport) as Uint8List; final export = JsonUtf8Encoder().convert(jsonExport) as Uint8List;
when(exportable.export).thenAnswer((final _) => value); when(exportable.export).thenAnswer((final _) => value);

34
packages/neon/neon/test/storage_test.dart

@ -33,48 +33,48 @@ void main() {
NeonStorage.mock(sharedPreferences); NeonStorage.mock(sharedPreferences);
const appStorage = AppStorage(StorageKeys.accounts); const appStorage = AppStorage(StorageKeys.accounts);
const key = 'key'; 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); dynamic result = appStorage.containsKey(key);
expect(result, equals(true)); 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); result = await appStorage.remove(key);
expect(result, equals(false)); 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); result = appStorage.getString(key);
expect(result, isNull); 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'); result = await appStorage.setString(key, 'value');
expect(result, false); 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); result = appStorage.getBool(key);
expect(result, equals(true)); 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); result = await appStorage.setBool(key, true);
expect(result, 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); result = appStorage.getStringList(key);
expect(result, equals(['hi there'])); 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)); .thenAnswer((final _) => Future.value(false));
result = await appStorage.setStringList(key, ['hi there']); result = await appStorage.setStringList(key, ['hi there']);
expect(result, false); expect(result, false);
verify(() => sharedPreferences.setStringList(formatedKey, ['hi there'])).called(1); verify(() => sharedPreferences.setStringList(formattedKey, ['hi there'])).called(1);
}); });
}); });

12
packages/neon/neon_files/lib/blocs/files.dart

@ -29,8 +29,8 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta
this.options, this.options,
this.account, this.account,
) { ) {
options.uploadQueueParallelism.addListener(_uploadParalelismListener); options.uploadQueueParallelism.addListener(_uploadParallelismListener);
options.downloadQueueParallelism.addListener(_downloadParalelismListener); options.downloadQueueParallelism.addListener(_downloadParallelismListener);
} }
final FilesAppSpecificOptions options; final FilesAppSpecificOptions options;
@ -46,8 +46,8 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta
_downloadQueue.dispose(); _downloadQueue.dispose();
unawaited(tasks.close()); unawaited(tasks.close());
options.uploadQueueParallelism.removeListener(_uploadParalelismListener); options.uploadQueueParallelism.removeListener(_uploadParallelismListener);
options.downloadQueueParallelism.removeListener(_downloadParalelismListener); options.downloadQueueParallelism.removeListener(_downloadParallelismListener);
} }
@override @override
@ -177,11 +177,11 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta
FilesBrowserBloc getNewFilesBrowserBloc() => FilesBrowserBloc(options, account); FilesBrowserBloc getNewFilesBrowserBloc() => FilesBrowserBloc(options, account);
void _downloadParalelismListener() { void _downloadParallelismListener() {
_downloadQueue.parallel = options.downloadQueueParallelism.value; _downloadQueue.parallel = options.downloadQueueParallelism.value;
} }
void _uploadParalelismListener() { void _uploadParallelismListener() {
_uploadQueue.parallel = options.uploadQueueParallelism.value; _uploadQueue.parallel = options.uploadQueueParallelism.value;
} }
} }

2
packages/neon/neon_files/lib/widgets/browser_view.dart

@ -4,7 +4,7 @@ part of '../neon_files.dart';
enum FilesBrowserMode { enum FilesBrowserMode {
/// Default file browser mode. /// 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, browser,
/// Select directory. /// Select directory.

Loading…
Cancel
Save