Browse Source

refactor(neon): mark classes as internal (mainly blocs and pages)

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/742/head
Nikolas Rimikis 1 year ago
parent
commit
191e87c4a0
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 2
      packages/neon/neon/lib/blocs.dart
  2. 2
      packages/neon/neon/lib/src/app.dart
  3. 2
      packages/neon/neon/lib/src/blocs/apps.dart
  4. 2
      packages/neon/neon/lib/src/blocs/capabilities.dart
  5. 2
      packages/neon/neon/lib/src/blocs/first_launch.dart
  6. 4
      packages/neon/neon/lib/src/blocs/login_check_account.dart
  7. 4
      packages/neon/neon/lib/src/blocs/login_check_server_status.dart
  8. 4
      packages/neon/neon/lib/src/blocs/login_flow.dart
  9. 2
      packages/neon/neon/lib/src/blocs/next_push.dart
  10. 2
      packages/neon/neon/lib/src/blocs/push_notifications.dart
  11. 2
      packages/neon/neon/lib/src/blocs/timer.dart
  12. 2
      packages/neon/neon/lib/src/blocs/unified_search.dart
  13. 2
      packages/neon/neon/lib/src/blocs/user_details.dart
  14. 2
      packages/neon/neon/lib/src/blocs/user_statuses.dart
  15. 2
      packages/neon/neon/lib/src/pages/account_settings.dart
  16. 2
      packages/neon/neon/lib/src/pages/home.dart
  17. 2
      packages/neon/neon/lib/src/pages/login.dart
  18. 2
      packages/neon/neon/lib/src/pages/login_check_account.dart
  19. 2
      packages/neon/neon/lib/src/pages/login_check_server_status.dart
  20. 2
      packages/neon/neon/lib/src/pages/login_flow.dart
  21. 2
      packages/neon/neon/lib/src/pages/login_qrcode.dart
  22. 2
      packages/neon/neon/lib/src/pages/nextcloud_app_settings.dart
  23. 4
      packages/neon/neon/lib/src/pages/route_not_found.dart
  24. 3
      packages/neon/neon/lib/src/pages/settings.dart
  25. 2
      packages/neon/neon/lib/src/settings/utils/settings_export_helper.dart
  26. 1
      packages/neon/neon/lib/src/utils/account_options.dart
  27. 2
      packages/neon/neon/lib/src/utils/global_options.dart
  28. 6
      packages/neon/neon/lib/src/utils/stream_listenable.dart
  29. 1
      packages/neon/neon/lib/src/utils/user_agent.dart

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

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

2
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<Result<List<CoreNavigationEntry>>> get apps;

2
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<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>> get capabilities;
}

2
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<void> get onFirstLaunch;
}

4
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<Result<Account>> get state;
}
@internal
class LoginCheckAccountBloc extends InteractiveBloc
implements LoginCheckAccountBlocEvents, LoginCheckAccountBlocStates {
LoginCheckAccountBloc(

4
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<Result<CoreStatus>> get state;
}
@internal
class LoginCheckServerStatusBloc extends InteractiveBloc
implements LoginCheckServerStatusBlocEvents, LoginCheckServerStatusBlocStates {
LoginCheckServerStatusBloc(this.serverURL) {

4
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<Result<CoreLoginFlowV2>> get init;
Stream<CoreLoginFlowV2Credentials> get result;
}
@internal
class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, LoginFlowBlocStates {
LoginFlowBloc(this.serverURL) {
unawaited(refresh());

2
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<void> get onNextPushSupported;
}

2
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<PushNotification> get notifications;
}

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

2
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<bool> get enabled;

2
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<Result<ProvisioningApiUserDetails>> get userDetails;
}

2
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<Map<String, Result<UserStatusPublicInterface?>>> get statuses;
}

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

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

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

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

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

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

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

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

4
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,

3
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,

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

1
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');

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

6
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<Stream<dynamic>> streams) {
streams.forEach(addSubscription);
streams.forEach(_addSubscription);
}
void addSubscription(final Stream<dynamic> stream) {
void _addSubscription(final Stream<dynamic> stream) {
_subscriptions.add(
stream.asBroadcastStream().listen((final _) {
notifyListeners();

1
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) {

Loading…
Cancel
Save