diff --git a/packages/app/integration_test/screenshot_test.dart b/packages/app/integration_test/screenshot_test.dart index def82780..5b9c4647 100644 --- a/packages/app/integration_test/screenshot_test.dart +++ b/packages/app/integration_test/screenshot_test.dart @@ -14,7 +14,7 @@ import 'package:neon/settings.dart'; import 'package:neon_files/widgets/actions.dart'; import 'package:shared_preferences/shared_preferences.dart'; -Future runTestApp( +Future runTestApp( final WidgetTester tester, final IntegrationTestWidgetsFlutterBinding binding, { final Account? account, @@ -30,18 +30,18 @@ Future runTestApp( await tester.pumpAndSettle(); } -Future openDrawer(final WidgetTester tester) async { +Future openDrawer(final WidgetTester tester) async { await tester.tap(find.byTooltip('Open navigation menu')); await tester.pumpAndSettle(); } -Future switchPage(final WidgetTester tester, final String name) async { +Future switchPage(final WidgetTester tester, final String name) async { await openDrawer(tester); await tester.tap(find.text(name).last); await tester.pumpAndSettle(); } -Future prepareScreenshot(final WidgetTester tester, final IntegrationTestWidgetsFlutterBinding binding) async { +Future prepareScreenshot(final WidgetTester tester, final IntegrationTestWidgetsFlutterBinding binding) async { await binding.convertFlutterSurfaceToImage(); await tester.pumpAndSettle(); } @@ -63,7 +63,7 @@ Future getAccount(final String username) async { ); } -Future main() async { +Future main() async { // The screenshots are pretty annoying on Android. See https://github.com/flutter/flutter/issues/92381 assert(Platform.isAndroid, 'Screenshots need to be taken on Android'); diff --git a/packages/app/lib/main.dart b/packages/app/lib/main.dart index 62c13ad3..c732b8ba 100644 --- a/packages/app/lib/main.dart +++ b/packages/app/lib/main.dart @@ -2,7 +2,7 @@ import 'package:app/apps.dart'; import 'package:app/branding.dart'; import 'package:neon/neon.dart'; -Future main() async { +Future main() async { await runNeon( appImplementations: appImplementations, theme: neonTheme, diff --git a/packages/dynamite/dynamite/lib/src/builder/client.dart b/packages/dynamite/dynamite/lib/src/builder/client.dart index 636fc18e..e941634b 100644 --- a/packages/dynamite/dynamite/lib/src/builder/client.dart +++ b/packages/dynamite/dynamite/lib/src/builder/client.dart @@ -604,7 +604,7 @@ final _response = await ${isRootClient ? 'this' : '_rootClient'}.doRequest( b.returns = refer('Future<$dataType>'); code.write('return $dataValue;'); } else { - b.returns = refer('Future'); + b.returns = refer('Future'); code.write('return;'); } diff --git a/packages/neon/neon/lib/blocs.dart b/packages/neon/neon/lib/blocs.dart index e160c0d7..c7c95a68 100644 --- a/packages/neon/neon/lib/blocs.dart +++ b/packages/neon/neon/lib/blocs.dart @@ -1,5 +1,6 @@ export 'package:neon/src/bloc/bloc.dart'; export 'package:neon/src/bloc/result.dart'; export 'package:neon/src/bloc/result_builder.dart'; -export 'package:neon/src/blocs/accounts.dart'; // TODO: Remove access to the AccountsBloc. Apps should not need to access this -export 'package:neon/src/blocs/timer.dart'; +// TODO: Remove access to the AccountsBloc. Apps should not need to access this +export 'package:neon/src/blocs/accounts.dart' show AccountsBloc; +export 'package:neon/src/blocs/timer.dart' hide TimerBlocEvents, TimerBlocStates; diff --git a/packages/neon/neon/lib/neon.dart b/packages/neon/neon/lib/neon.dart index 2df80d53..ba72a974 100644 --- a/packages/neon/neon/lib/neon.dart +++ b/packages/neon/neon/lib/neon.dart @@ -18,7 +18,7 @@ import 'package:neon/src/utils/user_agent.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:provider/provider.dart'; -Future runNeon({ +Future runNeon({ required final Iterable appImplementations, required final NeonTheme theme, @visibleForTesting final WidgetsBinding? bindingOverride, diff --git a/packages/neon/neon/lib/src/app.dart b/packages/neon/neon/lib/src/app.dart index 29e8a5f7..8129bcec 100644 --- a/packages/neon/neon/lib/src/app.dart +++ b/packages/neon/neon/lib/src/app.dart @@ -5,6 +5,7 @@ import 'dart:io'; import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; import 'package:flutter_native_splash/flutter_native_splash.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/bloc/result_builder.dart'; import 'package:neon/src/blocs/accounts.dart'; @@ -27,6 +28,7 @@ import 'package:quick_actions/quick_actions.dart'; import 'package:tray_manager/tray_manager.dart' as tray; import 'package:window_manager/window_manager.dart'; +@internal class NeonApp extends StatefulWidget { const NeonApp({ required this.neonTheme, @@ -196,7 +198,7 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra } @override - Future onWindowClose() async { + Future onWindowClose() async { if (_globalOptions.startupMinimizeInsteadOfExit.value) { await _saveAndMinimizeWindow(); } else { @@ -205,11 +207,11 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra } @override - Future onWindowMinimize() async { + Future onWindowMinimize() async { await _saveAndMinimizeWindow(); } - Future _handleShortcut(final String shortcutType) async { + Future _handleShortcut(final String shortcutType) async { if (shortcutType == 'show_hide') { if (NeonPlatform.instance.canUseWindowManager) { if (await windowManager.isVisible()) { @@ -231,13 +233,13 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra } } - Future _openAppFromExternal(final Account account, final String id) async { + Future _openAppFromExternal(final Account account, final String id) async { await _accountsBloc.getAppsBlocFor(account).setActiveApp(id); _navigatorKey.currentState!.popUntil((final route) => route.settings.name == 'home'); await _showAndRestoreWindow(); } - Future _saveAndMinimizeWindow() async { + Future _saveAndMinimizeWindow() async { _lastBounds = await windowManager.getBounds(); if (_globalOptions.systemTrayEnabled.value && _globalOptions.systemTrayHideToTrayWhenMinimized.value) { await windowManager.hide(); @@ -246,7 +248,7 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra } } - Future _showAndRestoreWindow() async { + Future _showAndRestoreWindow() async { if (!NeonPlatform.instance.canUseWindowManager) { return; } diff --git a/packages/neon/neon/lib/src/bloc/bloc.dart b/packages/neon/neon/lib/src/bloc/bloc.dart index 96263e4c..72629c47 100644 --- a/packages/neon/neon/lib/src/bloc/bloc.dart +++ b/packages/neon/neon/lib/src/bloc/bloc.dart @@ -17,7 +17,7 @@ abstract class InteractiveBloc extends Bloc { final _errorsStreamController = StreamController(); late Stream errors = _errorsStreamController.stream.asBroadcastStream(); - Future refresh(); + Future refresh(); void addError(final Object error) { _errorsStreamController.add(error); @@ -25,9 +25,9 @@ abstract class InteractiveBloc extends Bloc { // ignore: avoid_void_async void wrapAction( - final Future Function() call, { + final AsyncCallback call, { final bool disableTimeout = false, - final Future Function()? refresh, + final AsyncCallback? refresh, }) async { try { if (disableTimeout) { diff --git a/packages/neon/neon/lib/src/blocs/accounts.dart b/packages/neon/neon/lib/src/blocs/accounts.dart index 2bbf0331..c4ca84a8 100644 --- a/packages/neon/neon/lib/src/blocs/accounts.dart +++ b/packages/neon/neon/lib/src/blocs/accounts.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/foundation.dart'; +import 'package:meta/meta.dart'; import 'package:neon/src/bloc/bloc.dart'; import 'package:neon/src/blocs/apps.dart'; import 'package:neon/src/blocs/capabilities.dart'; @@ -17,6 +18,7 @@ import 'package:rxdart/rxdart.dart'; const _keyAccounts = 'accounts'; +@internal abstract interface class AccountsBlocEvents { /// Logs in the given [account]. /// @@ -40,6 +42,7 @@ abstract interface class AccountsBlocEvents { void setActiveAccount(final Account account); } +@internal abstract interface class AccountsBlocStates { /// All registered accounts. /// diff --git a/packages/neon/neon/lib/src/blocs/apps.dart b/packages/neon/neon/lib/src/blocs/apps.dart index bf7cd847..1492f9f7 100644 --- a/packages/neon/neon/lib/src/blocs/apps.dart +++ b/packages/neon/neon/lib/src/blocs/apps.dart @@ -16,7 +16,8 @@ import 'package:nextcloud/nextcloud.dart'; import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; -abstract class AppsBlocEvents { +@internal +abstract interface class AppsBlocEvents { /// Sets the active app using the [appID]. /// /// If the app is already the active app nothing will happen. @@ -24,7 +25,8 @@ abstract class AppsBlocEvents { void setActiveApp(final String appID, {final bool skipAlreadySet = false}); } -abstract class AppsBlocStates { +@internal +abstract interface class AppsBlocStates { BehaviorSubject>> get apps; BehaviorSubject>> get appImplementations; @@ -33,7 +35,7 @@ abstract class AppsBlocStates { BehaviorSubject get activeApp; - BehaviorSubject get openNotifications; + BehaviorSubject get openNotifications; BehaviorSubject?> get appVersions; } @@ -182,13 +184,13 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates BehaviorSubject>(); @override - BehaviorSubject openNotifications = BehaviorSubject(); + BehaviorSubject openNotifications = BehaviorSubject(); @override BehaviorSubject?> appVersions = BehaviorSubject(); @override - Future refresh() async { + Future refresh() async { await RequestManager.instance .wrapNextcloud, CoreNavigationGetAppsNavigationResponseApplicationJson>( _account.id, @@ -200,7 +202,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates } @override - Future setActiveApp(final String appID, {final bool skipAlreadySet = false}) async { + Future setActiveApp(final String appID, {final bool skipAlreadySet = false}) async { if (appID == AppIDs.notifications) { openNotifications.add(null); return; @@ -220,6 +222,6 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates T getAppBloc(final AppImplementation appImplementation) => appImplementation.getBloc(_account); - List get appBlocProviders => + List> get appBlocProviders => _allAppImplementations.map((final appImplementation) => appImplementation.blocProvider).toList(); } diff --git a/packages/neon/neon/lib/src/blocs/capabilities.dart b/packages/neon/neon/lib/src/blocs/capabilities.dart index e77eeeb0..a2f91e95 100644 --- a/packages/neon/neon/lib/src/blocs/capabilities.dart +++ b/packages/neon/neon/lib/src/blocs/capabilities.dart @@ -8,9 +8,11 @@ import 'package:neon/src/utils/request_manager.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; -abstract class CapabilitiesBlocEvents {} +@internal +abstract interface class CapabilitiesBlocEvents {} -abstract class CapabilitiesBlocStates { +@internal +abstract interface class CapabilitiesBlocStates { BehaviorSubject> get capabilities; } @@ -35,7 +37,7 @@ class CapabilitiesBloc extends InteractiveBloc implements CapabilitiesBlocEvents BehaviorSubject>(); @override - Future refresh() async { + Future refresh() async { await RequestManager.instance.wrapNextcloud( _account.id, diff --git a/packages/neon/neon/lib/src/blocs/first_launch.dart b/packages/neon/neon/lib/src/blocs/first_launch.dart index 056e9378..366b17f5 100644 --- a/packages/neon/neon/lib/src/blocs/first_launch.dart +++ b/packages/neon/neon/lib/src/blocs/first_launch.dart @@ -5,10 +5,12 @@ import 'package:neon/src/bloc/bloc.dart'; import 'package:neon/src/settings/models/storage.dart'; import 'package:rxdart/rxdart.dart'; -abstract class FirstLaunchBlocEvents {} +@internal +abstract interface class FirstLaunchBlocEvents {} -abstract class FirstLaunchBlocStates { - BehaviorSubject get onFirstLaunch; +@internal +abstract interface class FirstLaunchBlocStates { + BehaviorSubject get onFirstLaunch; } @immutable @@ -31,5 +33,5 @@ class FirstLaunchBloc extends Bloc implements FirstLaunchBlocEvents, FirstLaunch } @override - final BehaviorSubject onFirstLaunch = BehaviorSubject(); + final BehaviorSubject onFirstLaunch = BehaviorSubject(); } diff --git a/packages/neon/neon/lib/src/blocs/login_check_account.dart b/packages/neon/neon/lib/src/blocs/login_check_account.dart index f7b97561..337b3e56 100644 --- a/packages/neon/neon/lib/src/blocs/login_check_account.dart +++ b/packages/neon/neon/lib/src/blocs/login_check_account.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; +import 'package:meta/meta.dart'; import 'package:neon/src/bloc/bloc.dart'; import 'package:neon/src/bloc/result.dart'; import 'package:neon/src/models/account.dart'; @@ -8,13 +9,16 @@ import 'package:neon/src/utils/user_agent.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; +@internal abstract interface class LoginCheckAccountBlocEvents {} +@internal abstract interface class LoginCheckAccountBlocStates { /// Contains the account for the user BehaviorSubject> get state; } +@internal class LoginCheckAccountBloc extends InteractiveBloc implements LoginCheckAccountBlocEvents, LoginCheckAccountBlocStates { LoginCheckAccountBloc( @@ -40,7 +44,7 @@ class LoginCheckAccountBloc extends InteractiveBloc BehaviorSubject> state = BehaviorSubject(); @override - Future refresh() async { + Future refresh() async { state.add(Result.loading()); try { diff --git a/packages/neon/neon/lib/src/blocs/login_check_server_status.dart b/packages/neon/neon/lib/src/blocs/login_check_server_status.dart index a92529f1..1f7eeb4d 100644 --- a/packages/neon/neon/lib/src/blocs/login_check_server_status.dart +++ b/packages/neon/neon/lib/src/blocs/login_check_server_status.dart @@ -1,19 +1,23 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; +import 'package:meta/meta.dart'; import 'package:neon/src/bloc/bloc.dart'; import 'package:neon/src/bloc/result.dart'; import 'package:neon/src/utils/user_agent.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; +@internal abstract interface class LoginCheckServerStatusBlocEvents {} +@internal abstract interface class LoginCheckServerStatusBlocStates { /// Contains the current server connection state BehaviorSubject> get state; } +@internal class LoginCheckServerStatusBloc extends InteractiveBloc implements LoginCheckServerStatusBlocEvents, LoginCheckServerStatusBlocStates { LoginCheckServerStatusBloc(this.serverURL) { @@ -33,7 +37,7 @@ class LoginCheckServerStatusBloc extends InteractiveBloc BehaviorSubject> state = BehaviorSubject(); @override - Future refresh() async { + Future refresh() async { state.add(Result.loading()); try { diff --git a/packages/neon/neon/lib/src/blocs/login_flow.dart b/packages/neon/neon/lib/src/blocs/login_flow.dart index ee6cfc10..a0d3e892 100644 --- a/packages/neon/neon/lib/src/blocs/login_flow.dart +++ b/packages/neon/neon/lib/src/blocs/login_flow.dart @@ -1,20 +1,24 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; +import 'package:meta/meta.dart'; import 'package:neon/src/bloc/bloc.dart'; import 'package:neon/src/bloc/result.dart'; import 'package:neon/src/utils/user_agent.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; -abstract class LoginFlowBlocEvents {} +@internal +abstract interface class LoginFlowBlocEvents {} -abstract class LoginFlowBlocStates { +@internal +abstract interface class LoginFlowBlocStates { BehaviorSubject> get init; Stream get result; } +@internal class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, LoginFlowBlocStates { LoginFlowBloc(this.serverURL) { unawaited(refresh()); @@ -45,7 +49,7 @@ class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, Logi late Stream result = _resultController.stream.asBroadcastStream(); @override - Future refresh() async { + Future refresh() async { try { init.add(Result.loading()); diff --git a/packages/neon/neon/lib/src/blocs/next_push.dart b/packages/neon/neon/lib/src/blocs/next_push.dart index c1ba9bc3..0e9184f1 100644 --- a/packages/neon/neon/lib/src/blocs/next_push.dart +++ b/packages/neon/neon/lib/src/blocs/next_push.dart @@ -8,10 +8,12 @@ import 'package:neon/src/models/account.dart'; import 'package:neon/src/utils/global_options.dart'; import 'package:rxdart/rxdart.dart'; -abstract class NextPushBlocEvents {} +@internal +abstract interface class NextPushBlocEvents {} -abstract class NextPushBlocStates { - BehaviorSubject get onNextPushSupported; +@internal +abstract interface class NextPushBlocStates { + BehaviorSubject get onNextPushSupported; } @internal @@ -78,5 +80,5 @@ class NextPushBloc extends Bloc implements NextPushBlocEvents, NextPushBlocState } @override - BehaviorSubject onNextPushSupported = BehaviorSubject(); + BehaviorSubject onNextPushSupported = BehaviorSubject(); } diff --git a/packages/neon/neon/lib/src/blocs/push_notifications.dart b/packages/neon/neon/lib/src/blocs/push_notifications.dart index a701ade7..bc5c7051 100644 --- a/packages/neon/neon/lib/src/blocs/push_notifications.dart +++ b/packages/neon/neon/lib/src/blocs/push_notifications.dart @@ -14,9 +14,11 @@ import 'package:neon/src/utils/push_utils.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:unifiedpush/unifiedpush.dart'; -abstract class PushNotificationsBlocEvents {} +@internal +abstract interface class PushNotificationsBlocEvents {} -abstract class PushNotificationsBlocStates { +@internal +abstract interface class PushNotificationsBlocStates { Stream get notifications; } @@ -40,7 +42,7 @@ class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents, final GlobalOptions _globalOptions; final _notificationsController = StreamController(); - StreamSubscription? _accountsListener; + StreamSubscription>? _accountsListener; @override void dispose() { @@ -66,7 +68,7 @@ class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents, } } - Future _setupUnifiedPush() async { + Future _setupUnifiedPush() async { // We just use a single RSA keypair for all accounts final keypair = await PushUtils.loadRSAKeypair(); @@ -118,7 +120,7 @@ class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents, } } - Future _unregisterUnifiedPushInstances(final List accounts) async { + Future _unregisterUnifiedPushInstances(final List accounts) async { for (final account in accounts) { try { await account.client.notifications.push.removeDevice(); @@ -130,7 +132,7 @@ class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents, } } - Future _registerUnifiedPushInstances(final List accounts) async { + Future _registerUnifiedPushInstances(final List accounts) async { // Notifications will only work on accounts with app password for (final account in accounts.where((final a) => a.password != null)) { await UnifiedPush.registerApp(account.id); diff --git a/packages/neon/neon/lib/src/blocs/timer.dart b/packages/neon/neon/lib/src/blocs/timer.dart index b839b414..31a7269a 100644 --- a/packages/neon/neon/lib/src/blocs/timer.dart +++ b/packages/neon/neon/lib/src/blocs/timer.dart @@ -4,7 +4,8 @@ import 'dart:ui'; import 'package:meta/meta.dart'; import 'package:neon/src/bloc/bloc.dart'; -abstract class TimerBlocEvents { +@internal +abstract interface class TimerBlocEvents { /// Register a [callback] that will be called periodically. /// The time between the executions is defined by the [duration]. NeonTimer registerTimer(final Duration duration, final VoidCallback callback); @@ -14,7 +15,8 @@ abstract class TimerBlocEvents { void unregisterTimer(final NeonTimer timer); } -abstract class TimerBlocStates {} +@internal +abstract interface class TimerBlocStates {} /// Execute callbacks at defined periodic intervals. /// Components can register their callbacks and everything with the same periodicity will be executed at the same time. diff --git a/packages/neon/neon/lib/src/blocs/unified_search.dart b/packages/neon/neon/lib/src/blocs/unified_search.dart index 2a998601..a20e59ad 100644 --- a/packages/neon/neon/lib/src/blocs/unified_search.dart +++ b/packages/neon/neon/lib/src/blocs/unified_search.dart @@ -10,6 +10,7 @@ import 'package:neon/src/blocs/apps.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; +@internal abstract interface class UnifiedSearchBlocEvents { void search(final String term); @@ -18,6 +19,7 @@ abstract interface class UnifiedSearchBlocEvents { void disable(); } +@internal abstract interface class UnifiedSearchBlocStates { BehaviorSubject get enabled; @@ -56,12 +58,12 @@ class UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBlocEven } @override - Future refresh() async { + Future refresh() async { await _search(); } @override - Future search(final String term) async { + Future search(final String term) async { _term = term.trim(); await _search(); } @@ -78,7 +80,7 @@ class UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBlocEven _term = ''; } - Future _search() async { + Future _search() async { if (_term.isEmpty) { results.add(Result.success(null)); return; @@ -108,7 +110,7 @@ class UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBlocEven } } - Future _searchProvider(final CoreUnifiedSearchProvider provider) async { + Future _searchProvider(final CoreUnifiedSearchProvider provider) async { _updateResults(provider, Result.loading()); try { final response = await _account.client.core.unifiedSearch.search( diff --git a/packages/neon/neon/lib/src/blocs/user_details.dart b/packages/neon/neon/lib/src/blocs/user_details.dart index 6df57f3c..d109406b 100644 --- a/packages/neon/neon/lib/src/blocs/user_details.dart +++ b/packages/neon/neon/lib/src/blocs/user_details.dart @@ -8,9 +8,11 @@ import 'package:neon/src/utils/request_manager.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; -abstract class UserDetailsBlocEvents {} +@internal +abstract interface class UserDetailsBlocEvents {} -abstract class UserDetailsBlocStates { +@internal +abstract interface class UserDetailsBlocStates { BehaviorSubject> get userDetails; } @@ -35,7 +37,7 @@ class UserDetailsBloc extends InteractiveBloc implements UserDetailsBlocEvents, BehaviorSubject>(); @override - Future refresh() async { + Future refresh() async { await RequestManager.instance .wrapNextcloud( _account.id, diff --git a/packages/neon/neon/lib/src/blocs/user_statuses.dart b/packages/neon/neon/lib/src/blocs/user_statuses.dart index 03f5e0b7..5cf0dd3b 100644 --- a/packages/neon/neon/lib/src/blocs/user_statuses.dart +++ b/packages/neon/neon/lib/src/blocs/user_statuses.dart @@ -11,11 +11,13 @@ import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; import 'package:window_manager/window_manager.dart'; -abstract class UserStatusesBlocEvents { +@internal +abstract interface class UserStatusesBlocEvents { void load(final String username, {final bool force = false}); } -abstract class UserStatusesBlocStates { +@internal +abstract interface class UserStatusesBlocStates { BehaviorSubject>> get statuses; } @@ -43,14 +45,14 @@ class UserStatusesBloc extends InteractiveBloc implements UserStatusesBlocEvents BehaviorSubject>>(); @override - Future refresh() async { + Future refresh() async { for (final username in _statuses.keys) { await load(username, force: true); } } @override - Future load(final String username, {final bool force = false}) async { + Future load(final String username, {final bool force = false}) async { if (!force && _statuses.containsKey(username)) { return; } diff --git a/packages/neon/neon/lib/src/models/app_implementation.dart b/packages/neon/neon/lib/src/models/app_implementation.dart index 4ea33c1a..a36936cd 100644 --- a/packages/neon/neon/lib/src/models/app_implementation.dart +++ b/packages/neon/neon/lib/src/models/app_implementation.dart @@ -18,7 +18,7 @@ abstract class AppImplementation AppImplementation(); String get id; - LocalizationsDelegate get localizationsDelegate; + LocalizationsDelegate get localizationsDelegate; List get supportedLocales; String nameFromLocalization(final AppLocalizations localizations) => localizations.appImplementationName(id); diff --git a/packages/neon/neon/lib/src/pages/account_settings.dart b/packages/neon/neon/lib/src/pages/account_settings.dart index ef1d2c2f..15771698 100644 --- a/packages/neon/neon/lib/src/pages/account_settings.dart +++ b/packages/neon/neon/lib/src/pages/account_settings.dart @@ -1,6 +1,7 @@ import 'package:filesize/filesize.dart'; import 'package:flutter/material.dart'; import 'package:flutter_material_design_icons/flutter_material_design_icons.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/bloc/result_builder.dart'; import 'package:neon/src/blocs/accounts.dart'; @@ -16,6 +17,7 @@ import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:nextcloud/nextcloud.dart'; +@internal class AccountSettingsPage extends StatelessWidget { const AccountSettingsPage({ required this.bloc, diff --git a/packages/neon/neon/lib/src/pages/home.dart b/packages/neon/neon/lib/src/pages/home.dart index a76f932a..29701d56 100644 --- a/packages/neon/neon/lib/src/pages/home.dart +++ b/packages/neon/neon/lib/src/pages/home.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/bloc/result_builder.dart'; import 'package:neon/src/blocs/accounts.dart'; @@ -16,6 +17,7 @@ import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/unified_search_results.dart'; import 'package:provider/provider.dart'; +@internal class HomePage extends StatefulWidget { const HomePage({ super.key, @@ -32,7 +34,7 @@ class _HomePageState extends State { late GlobalOptions _globalOptions; late AccountsBloc _accountsBloc; late AppsBloc _appsBloc; - late StreamSubscription _versionCheckSubscription; + late StreamSubscription?> _versionCheckSubscription; @override void initState() { @@ -76,7 +78,7 @@ class _HomePageState extends State { super.dispose(); } - Future _checkMaintenanceMode() async { + Future _checkMaintenanceMode() async { try { final status = await _account.client.core.getStatus(); if (status.maintenance && mounted) { @@ -93,7 +95,7 @@ class _HomePageState extends State { } } - Future _showProblem(final String title) async { + Future _showProblem(final String title) async { final colorScheme = Theme.of(context).colorScheme; await showDialog( diff --git a/packages/neon/neon/lib/src/pages/login.dart b/packages/neon/neon/lib/src/pages/login.dart index ddcfd9e9..f6ea1caa 100644 --- a/packages/neon/neon/lib/src/pages/login.dart +++ b/packages/neon/neon/lib/src/pages/login.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/platform/platform.dart'; import 'package:neon/src/router.dart'; @@ -7,6 +8,7 @@ import 'package:neon/src/theme/dialog.dart'; import 'package:neon/src/utils/validators.dart'; import 'package:neon/src/widgets/nextcloud_logo.dart'; +@internal class LoginPage extends StatefulWidget { const LoginPage({ super.key, diff --git a/packages/neon/neon/lib/src/pages/login_check_account.dart b/packages/neon/neon/lib/src/pages/login_check_account.dart index b117aa6e..50399e0e 100644 --- a/packages/neon/neon/lib/src/pages/login_check_account.dart +++ b/packages/neon/neon/lib/src/pages/login_check_account.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/bloc/result.dart'; import 'package:neon/src/bloc/result_builder.dart'; @@ -14,6 +15,7 @@ import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/validation_tile.dart'; import 'package:provider/provider.dart'; +@internal class LoginCheckAccountPage extends StatefulWidget { const LoginCheckAccountPage({ required this.serverURL, diff --git a/packages/neon/neon/lib/src/pages/login_check_server_status.dart b/packages/neon/neon/lib/src/pages/login_check_server_status.dart index 7c777669..aee497a2 100644 --- a/packages/neon/neon/lib/src/pages/login_check_server_status.dart +++ b/packages/neon/neon/lib/src/pages/login_check_server_status.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/bloc/result.dart'; import 'package:neon/src/bloc/result_builder.dart'; @@ -9,6 +10,7 @@ import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/validation_tile.dart'; import 'package:nextcloud/nextcloud.dart'; +@internal class LoginCheckServerStatusPage extends StatefulWidget { const LoginCheckServerStatusPage({ required this.serverURL, diff --git a/packages/neon/neon/lib/src/pages/login_flow.dart b/packages/neon/neon/lib/src/pages/login_flow.dart index ba631c48..99fef108 100644 --- a/packages/neon/neon/lib/src/pages/login_flow.dart +++ b/packages/neon/neon/lib/src/pages/login_flow.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/bloc/result_builder.dart'; import 'package:neon/src/blocs/login_flow.dart'; @@ -7,6 +8,7 @@ import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:url_launcher/url_launcher_string.dart'; +@internal class LoginFlowPage extends StatefulWidget { const LoginFlowPage({ required this.serverURL, diff --git a/packages/neon/neon/lib/src/pages/login_qrcode.dart b/packages/neon/neon/lib/src/pages/login_qrcode.dart index c92edb0b..8a581e0d 100644 --- a/packages/neon/neon/lib/src/pages/login_qrcode.dart +++ b/packages/neon/neon/lib/src/pages/login_qrcode.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_zxing/flutter_zxing.dart'; +import 'package:meta/meta.dart'; import 'package:neon/src/models/account.dart'; import 'package:neon/src/router.dart'; import 'package:neon/src/utils/exceptions.dart'; import 'package:neon/src/widgets/exception.dart'; +@internal class LoginQrcodePage extends StatefulWidget { const LoginQrcodePage({ super.key, diff --git a/packages/neon/neon/lib/src/pages/nextcloud_app_settings.dart b/packages/neon/neon/lib/src/pages/nextcloud_app_settings.dart index 391b5a94..f3a2d4cf 100644 --- a/packages/neon/neon/lib/src/pages/nextcloud_app_settings.dart +++ b/packages/neon/neon/lib/src/pages/nextcloud_app_settings.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_material_design_icons/flutter_material_design_icons.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/models/app_implementation.dart'; import 'package:neon/src/settings/models/select_option.dart'; @@ -11,6 +12,7 @@ import 'package:neon/src/settings/widgets/settings_list.dart'; import 'package:neon/src/theme/dialog.dart'; import 'package:neon/src/utils/confirmation_dialog.dart'; +@internal class NextcloudAppSettingsPage extends StatelessWidget { const NextcloudAppSettingsPage({ required this.appImplementation, diff --git a/packages/neon/neon/lib/src/pages/route_not_found.dart b/packages/neon/neon/lib/src/pages/route_not_found.dart index 884172f2..804d792e 100644 --- a/packages/neon/neon/lib/src/pages/route_not_found.dart +++ b/packages/neon/neon/lib/src/pages/route_not_found.dart @@ -1,12 +1,14 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:neon/blocs.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; +import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/router.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +@internal class RouteNotFoundPage extends StatefulWidget { const RouteNotFoundPage({ required this.uri, @@ -27,7 +29,7 @@ class _RouteNotFoundPageState extends State { unawaited(_checkLaunchable()); } - Future _checkLaunchable() async { + Future _checkLaunchable() async { final accountsBloc = Provider.of(context, listen: false); if (!accountsBloc.hasAccounts) { return; diff --git a/packages/neon/neon/lib/src/pages/settings.dart b/packages/neon/neon/lib/src/pages/settings.dart index a9278e7f..1f233500 100644 --- a/packages/neon/neon/lib/src/pages/settings.dart +++ b/packages/neon/neon/lib/src/pages/settings.dart @@ -1,6 +1,7 @@ import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_material_design_icons/flutter_material_design_icons.dart'; +import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/models/account.dart'; @@ -26,6 +27,7 @@ import 'package:package_info_plus/package_info_plus.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher_string.dart'; +@internal enum SettingsCategories { apps, theme, @@ -37,6 +39,7 @@ enum SettingsCategories { other, } +@internal class SettingsPage extends StatefulWidget { const SettingsPage({ this.initialCategory, diff --git a/packages/neon/neon/lib/src/platform/platform.dart b/packages/neon/neon/lib/src/platform/platform.dart index 0bedd437..8c541890 100644 --- a/packages/neon/neon/lib/src/platform/platform.dart +++ b/packages/neon/neon/lib/src/platform/platform.dart @@ -16,7 +16,7 @@ abstract interface class NeonPlatform { /// Infers and configures the platform automatically. /// /// Required to be called before accessing [NeonPlatform.instance]. - static Future setup() async { + static Future setup() async { if (Platform.isAndroid) { _platform = const AndroidNeonPlatform(); } else if (Platform.isLinux) { @@ -55,5 +55,5 @@ abstract interface class NeonPlatform { FutureOr get userAccessibleAppDataPath; - FutureOr init(); + FutureOr init(); } diff --git a/packages/neon/neon/lib/src/router.dart b/packages/neon/neon/lib/src/router.dart index 38290042..6e666b70 100644 --- a/packages/neon/neon/lib/src/router.dart +++ b/packages/neon/neon/lib/src/router.dart @@ -62,7 +62,7 @@ class AppRouter extends GoRouter { routes: $appRoutes, ); - static Page _buildErrorPage(final BuildContext context, final GoRouterState state) => MaterialPage( + static Page _buildErrorPage(final BuildContext context, final GoRouterState state) => MaterialPage( child: RouteNotFoundPage( uri: state.uri, ), 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 59e5b4a6..a2e5c310 100644 --- a/packages/neon/neon/lib/src/settings/models/options_collection.dart +++ b/packages/neon/neon/lib/src/settings/models/options_collection.dart @@ -14,7 +14,7 @@ abstract class OptionsCollection implements Exportable { /// Collection of options. @protected - Iterable