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. 4
      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.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;

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.
///
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('/')) {

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

@ -26,7 +26,7 @@ class ResultBuilder<T> extends StreamBuilderBase<Result<T>, Result<T>> {
@override
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) {
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.
///
/// 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<T extends Bloc, R extends NextcloudAppOptions>
/// 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;
}

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: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<SettingsPage> createState() => _SettingsPageState();
@ -96,7 +96,7 @@ class _SettingsPageState extends State<SettingsPage> {
categories: [
SettingsCategory(
title: Text(AppLocalizations.of(context).settingsApps),
key: ValueKey(SettingsCageories.apps.name),
key: ValueKey(SettingsCategories.apps.name),
tiles: <SettingsTile>[
for (final appImplementation in appImplementations) ...[
if (appImplementation.options.options.isNotEmpty) ...[
@ -113,7 +113,7 @@ class _SettingsPageState extends State<SettingsPage> {
),
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<SettingsPage> {
),
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<SettingsPage> {
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<SettingsPage> {
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<SettingsPage> {
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<SettingsPage> {
],
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<SettingsPage> {
),
SettingsCategory(
title: Text(AppLocalizations.of(context).optionsCategoryOther),
key: ValueKey(SettingsCageories.other.name),
key: ValueKey(SettingsCategories.other.name),
tiles: <SettingsTile>[
CustomSettingsTile(
leading: Icon(

4
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);

22
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 {

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 {
NextcloudAppOptions(super.storage);

2
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

2
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);
},
),
),

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));
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),
onTap: () {
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 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);

34
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);
});
});

12
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;
}
}

2
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.

Loading…
Cancel
Save