diff --git a/packages/neon/neon/lib/blocs.dart b/packages/neon/neon/lib/blocs.dart index e160c0d7..bc6f4cb2 100644 --- a/packages/neon/neon/lib/blocs.dart +++ b/packages/neon/neon/lib/blocs.dart @@ -2,4 +2,4 @@ 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'; +export 'package:neon/src/blocs/timer.dart' hide TimerBlocEvents, TimerBlocStates; diff --git a/packages/neon/neon/lib/src/app.dart b/packages/neon/neon/lib/src/app.dart index e06ed853..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, diff --git a/packages/neon/neon/lib/src/blocs/apps.dart b/packages/neon/neon/lib/src/blocs/apps.dart index fdcba90c..1492f9f7 100644 --- a/packages/neon/neon/lib/src/blocs/apps.dart +++ b/packages/neon/neon/lib/src/blocs/apps.dart @@ -16,6 +16,7 @@ import 'package:nextcloud/nextcloud.dart'; import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; +@internal abstract interface class AppsBlocEvents { /// Sets the active app using the [appID]. /// @@ -24,6 +25,7 @@ abstract interface class AppsBlocEvents { void setActiveApp(final String appID, {final bool skipAlreadySet = false}); } +@internal abstract interface class AppsBlocStates { BehaviorSubject>> get apps; diff --git a/packages/neon/neon/lib/src/blocs/capabilities.dart b/packages/neon/neon/lib/src/blocs/capabilities.dart index 4070c6f0..a2f91e95 100644 --- a/packages/neon/neon/lib/src/blocs/capabilities.dart +++ b/packages/neon/neon/lib/src/blocs/capabilities.dart @@ -8,8 +8,10 @@ import 'package:neon/src/utils/request_manager.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; +@internal abstract interface class CapabilitiesBlocEvents {} +@internal abstract interface class CapabilitiesBlocStates { BehaviorSubject> get capabilities; } diff --git a/packages/neon/neon/lib/src/blocs/first_launch.dart b/packages/neon/neon/lib/src/blocs/first_launch.dart index 7d32a371..366b17f5 100644 --- a/packages/neon/neon/lib/src/blocs/first_launch.dart +++ b/packages/neon/neon/lib/src/blocs/first_launch.dart @@ -5,8 +5,10 @@ import 'package:neon/src/bloc/bloc.dart'; import 'package:neon/src/settings/models/storage.dart'; import 'package:rxdart/rxdart.dart'; +@internal abstract interface class FirstLaunchBlocEvents {} +@internal abstract interface class FirstLaunchBlocStates { BehaviorSubject get onFirstLaunch; } 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 bffccfeb..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( 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 a31b7922..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) { diff --git a/packages/neon/neon/lib/src/blocs/login_flow.dart b/packages/neon/neon/lib/src/blocs/login_flow.dart index cd8d0d17..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'; +@internal abstract interface class LoginFlowBlocEvents {} +@internal abstract interface class LoginFlowBlocStates { BehaviorSubject> get init; Stream get result; } +@internal class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, LoginFlowBlocStates { LoginFlowBloc(this.serverURL) { unawaited(refresh()); diff --git a/packages/neon/neon/lib/src/blocs/next_push.dart b/packages/neon/neon/lib/src/blocs/next_push.dart index 463cc32f..0e9184f1 100644 --- a/packages/neon/neon/lib/src/blocs/next_push.dart +++ b/packages/neon/neon/lib/src/blocs/next_push.dart @@ -8,8 +8,10 @@ import 'package:neon/src/models/account.dart'; import 'package:neon/src/utils/global_options.dart'; import 'package:rxdart/rxdart.dart'; +@internal abstract interface class NextPushBlocEvents {} +@internal abstract interface class NextPushBlocStates { BehaviorSubject get onNextPushSupported; } diff --git a/packages/neon/neon/lib/src/blocs/push_notifications.dart b/packages/neon/neon/lib/src/blocs/push_notifications.dart index cc6c43d9..bc5c7051 100644 --- a/packages/neon/neon/lib/src/blocs/push_notifications.dart +++ b/packages/neon/neon/lib/src/blocs/push_notifications.dart @@ -14,8 +14,10 @@ import 'package:neon/src/utils/push_utils.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:unifiedpush/unifiedpush.dart'; +@internal abstract interface class PushNotificationsBlocEvents {} +@internal abstract interface class PushNotificationsBlocStates { Stream get notifications; } diff --git a/packages/neon/neon/lib/src/blocs/timer.dart b/packages/neon/neon/lib/src/blocs/timer.dart index a765202a..31a7269a 100644 --- a/packages/neon/neon/lib/src/blocs/timer.dart +++ b/packages/neon/neon/lib/src/blocs/timer.dart @@ -4,6 +4,7 @@ import 'dart:ui'; import 'package:meta/meta.dart'; import 'package:neon/src/bloc/bloc.dart'; +@internal abstract interface class TimerBlocEvents { /// Register a [callback] that will be called periodically. /// The time between the executions is defined by the [duration]. @@ -14,6 +15,7 @@ abstract interface class TimerBlocEvents { void unregisterTimer(final NeonTimer timer); } +@internal abstract interface class TimerBlocStates {} /// Execute callbacks at defined periodic intervals. diff --git a/packages/neon/neon/lib/src/blocs/unified_search.dart b/packages/neon/neon/lib/src/blocs/unified_search.dart index 6c67da69..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; diff --git a/packages/neon/neon/lib/src/blocs/user_details.dart b/packages/neon/neon/lib/src/blocs/user_details.dart index 05d00a45..d109406b 100644 --- a/packages/neon/neon/lib/src/blocs/user_details.dart +++ b/packages/neon/neon/lib/src/blocs/user_details.dart @@ -8,8 +8,10 @@ import 'package:neon/src/utils/request_manager.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; +@internal abstract interface class UserDetailsBlocEvents {} +@internal abstract interface class UserDetailsBlocStates { BehaviorSubject> get userDetails; } diff --git a/packages/neon/neon/lib/src/blocs/user_statuses.dart b/packages/neon/neon/lib/src/blocs/user_statuses.dart index ee503caa..5cf0dd3b 100644 --- a/packages/neon/neon/lib/src/blocs/user_statuses.dart +++ b/packages/neon/neon/lib/src/blocs/user_statuses.dart @@ -11,10 +11,12 @@ import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; import 'package:window_manager/window_manager.dart'; +@internal abstract interface class UserStatusesBlocEvents { void load(final String username, {final bool force = false}); } +@internal abstract interface class UserStatusesBlocStates { BehaviorSubject>> get statuses; } 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 acec5a12..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, 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 1cc133af..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, 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/settings/utils/settings_export_helper.dart b/packages/neon/neon/lib/src/settings/utils/settings_export_helper.dart index a5e34a5c..acda7208 100644 --- a/packages/neon/neon/lib/src/settings/utils/settings_export_helper.dart +++ b/packages/neon/neon/lib/src/settings/utils/settings_export_helper.dart @@ -74,6 +74,7 @@ class SettingsExportHelper { } /// Helper class to export [AppImplementation]s implementing the [Exportable] interface. +@internal @immutable class AppImplementationsExporter implements Exportable { const AppImplementationsExporter(this.appImplementations); @@ -109,6 +110,7 @@ class AppImplementationsExporter implements Exportable { } /// Helper class to export [Account]s implementing the [Exportable] interface. +@internal @immutable class AccountsBlocExporter implements Exportable { const AccountsBlocExporter(this.accountsBloc); diff --git a/packages/neon/neon/lib/src/utils/account_options.dart b/packages/neon/neon/lib/src/utils/account_options.dart index ea95f93d..f89bc393 100644 --- a/packages/neon/neon/lib/src/utils/account_options.dart +++ b/packages/neon/neon/lib/src/utils/account_options.dart @@ -43,6 +43,7 @@ class AccountSpecificOptions extends OptionsCollection { ); } +@internal enum AccountOptionKeys implements Storable { initialApp._('initial-app'); diff --git a/packages/neon/neon/lib/src/utils/global_options.dart b/packages/neon/neon/lib/src/utils/global_options.dart index eac4bccc..0979608c 100644 --- a/packages/neon/neon/lib/src/utils/global_options.dart +++ b/packages/neon/neon/lib/src/utils/global_options.dart @@ -221,6 +221,7 @@ class GlobalOptions extends OptionsCollection { ); } +@internal enum GlobalOptionKeys implements Storable { themeMode._('theme-mode'), themeOledAsDark._('theme-oled-as-dark'), @@ -241,6 +242,7 @@ enum GlobalOptionKeys implements Storable { final String value; } +@internal enum NavigationMode { drawer, drawerAlwaysVisible, diff --git a/packages/neon/neon/lib/src/utils/stream_listenable.dart b/packages/neon/neon/lib/src/utils/stream_listenable.dart index 3f47903b..8005fe94 100644 --- a/packages/neon/neon/lib/src/utils/stream_listenable.dart +++ b/packages/neon/neon/lib/src/utils/stream_listenable.dart @@ -14,17 +14,17 @@ class StreamListenable extends ChangeNotifier { notifyListeners(); } - addSubscription(stream); + _addSubscription(stream); } /// Listenable for multiple Streams. /// /// Notifies it's listeners on every event emitted by any of the streams. StreamListenable.multiListenable(final Iterable> streams) { - streams.forEach(addSubscription); + streams.forEach(_addSubscription); } - void addSubscription(final Stream stream) { + void _addSubscription(final Stream stream) { _subscriptions.add( stream.asBroadcastStream().listen((final _) { notifyListeners(); diff --git a/packages/neon/neon/lib/src/utils/user_agent.dart b/packages/neon/neon/lib/src/utils/user_agent.dart index 4612edcc..f8f924ae 100644 --- a/packages/neon/neon/lib/src/utils/user_agent.dart +++ b/packages/neon/neon/lib/src/utils/user_agent.dart @@ -3,6 +3,7 @@ import 'package:package_info_plus/package_info_plus.dart'; late String? _userAgent; +@internal void buildUserAgent(final PackageInfo packageInfo) { var buildNumber = packageInfo.buildNumber; if (buildNumber.isEmpty) {