From 1e244ab9be6b2b32d44ac9cd375ef2d77981632f Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Thu, 25 May 2023 14:31:57 +0200 Subject: [PATCH] neon: make blocs a separate library --- packages/neon/neon/lib/neon.dart | 13 ++--------- .../neon/neon/lib/src/blocs/accounts.dart | 2 +- packages/neon/neon/lib/src/blocs/apps.dart | 2 +- packages/neon/neon/lib/src/blocs/blocs.dart | 23 +++++++++++++++++++ .../neon/neon/lib/src/blocs/capabilities.dart | 2 +- .../neon/neon/lib/src/blocs/first_launch.dart | 2 +- packages/neon/neon/lib/src/blocs/login.dart | 2 +- .../neon/neon/lib/src/blocs/next_push.dart | 2 +- .../lib/src/blocs/push_notifications.dart | 2 +- packages/neon/neon/lib/src/blocs/timer.dart | 2 +- .../neon/neon/lib/src/blocs/user_details.dart | 2 +- .../neon/lib/src/blocs/user_statuses.dart | 2 +- 12 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 packages/neon/neon/lib/src/blocs/blocs.dart diff --git a/packages/neon/neon/lib/neon.dart b/packages/neon/neon/lib/neon.dart index 6992799e..6294ebf9 100644 --- a/packages/neon/neon/lib/neon.dart +++ b/packages/neon/neon/lib/neon.dart @@ -21,6 +21,7 @@ import 'package:http/http.dart'; import 'package:intl/intl_standalone.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:neon/l10n/localizations.dart'; +import 'package:neon/src/blocs/blocs.dart'; import 'package:neon/src/models/account.dart'; import 'package:neon/src/models/push_notification.dart'; import 'package:neon/src/router.dart'; @@ -38,27 +39,17 @@ import 'package:sort_box/sort_box.dart'; import 'package:sqflite/sqflite.dart'; import 'package:sqflite_common_ffi/sqflite_ffi.dart'; import 'package:tray_manager/tray_manager.dart' as tray; -import 'package:unifiedpush/unifiedpush.dart'; import 'package:url_launcher/url_launcher_string.dart'; import 'package:webview_flutter/webview_flutter.dart'; import 'package:window_manager/window_manager.dart'; import 'package:xdg_directories/xdg_directories.dart' as xdg; import 'package:xml/xml.dart' as xml; +export 'src/blocs/blocs.dart'; export 'src/models/account.dart'; export 'src/models/push_notification.dart'; part 'src/app.dart'; -part 'src/blocs/accounts.dart'; -part 'src/blocs/apps.dart'; -part 'src/blocs/capabilities.dart'; -part 'src/blocs/first_launch.dart'; -part 'src/blocs/login.dart'; -part 'src/blocs/next_push.dart'; -part 'src/blocs/push_notifications.dart'; -part 'src/blocs/timer.dart'; -part 'src/blocs/user_details.dart'; -part 'src/blocs/user_statuses.dart'; part 'src/interfaces/notifications.dart'; part 'src/pages/account_settings.dart'; part 'src/pages/home.dart'; diff --git a/packages/neon/neon/lib/src/blocs/accounts.dart b/packages/neon/neon/lib/src/blocs/accounts.dart index 1fda9d6b..1741e52d 100644 --- a/packages/neon/neon/lib/src/blocs/accounts.dart +++ b/packages/neon/neon/lib/src/blocs/accounts.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; const _keyAccounts = 'accounts'; diff --git a/packages/neon/neon/lib/src/blocs/apps.dart b/packages/neon/neon/lib/src/blocs/apps.dart index 3654250f..a2c799cc 100644 --- a/packages/neon/neon/lib/src/blocs/apps.dart +++ b/packages/neon/neon/lib/src/blocs/apps.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; typedef NextcloudApp = NextcloudCoreNavigationApps_Ocs_Data; diff --git a/packages/neon/neon/lib/src/blocs/blocs.dart b/packages/neon/neon/lib/src/blocs/blocs.dart new file mode 100644 index 00000000..e411e525 --- /dev/null +++ b/packages/neon/neon/lib/src/blocs/blocs.dart @@ -0,0 +1,23 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:flutter/foundation.dart'; +import 'package:neon/neon.dart'; +import 'package:nextcloud/nextcloud.dart'; +import 'package:package_info_plus/package_info_plus.dart'; +import 'package:provider/provider.dart'; +import 'package:rxdart/rxdart.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:unifiedpush/unifiedpush.dart'; +import 'package:window_manager/window_manager.dart'; + +part 'accounts.dart'; +part 'apps.dart'; +part 'capabilities.dart'; +part 'first_launch.dart'; +part 'login.dart'; +part 'next_push.dart'; +part 'push_notifications.dart'; +part 'user_details.dart'; +part 'timer.dart'; +part 'user_statuses.dart'; diff --git a/packages/neon/neon/lib/src/blocs/capabilities.dart b/packages/neon/neon/lib/src/blocs/capabilities.dart index 04c7fcd1..bc50560d 100644 --- a/packages/neon/neon/lib/src/blocs/capabilities.dart +++ b/packages/neon/neon/lib/src/blocs/capabilities.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; typedef Capabilities = NextcloudCoreServerCapabilities_Ocs_Data; typedef NextcloudTheme = NextcloudCoreServerCapabilities_Ocs_Data_Capabilities_Theming; diff --git a/packages/neon/neon/lib/src/blocs/first_launch.dart b/packages/neon/neon/lib/src/blocs/first_launch.dart index 92bf2ab4..6716d461 100644 --- a/packages/neon/neon/lib/src/blocs/first_launch.dart +++ b/packages/neon/neon/lib/src/blocs/first_launch.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; abstract class FirstLaunchBlocEvents {} diff --git a/packages/neon/neon/lib/src/blocs/login.dart b/packages/neon/neon/lib/src/blocs/login.dart index 83f3d5f4..cf64e39d 100644 --- a/packages/neon/neon/lib/src/blocs/login.dart +++ b/packages/neon/neon/lib/src/blocs/login.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; abstract class LoginBlocEvents { void setServerURL(final String? url); diff --git a/packages/neon/neon/lib/src/blocs/next_push.dart b/packages/neon/neon/lib/src/blocs/next_push.dart index d13b35a9..59c06137 100644 --- a/packages/neon/neon/lib/src/blocs/next_push.dart +++ b/packages/neon/neon/lib/src/blocs/next_push.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; abstract class NextPushBlocEvents {} diff --git a/packages/neon/neon/lib/src/blocs/push_notifications.dart b/packages/neon/neon/lib/src/blocs/push_notifications.dart index 794218e8..9e37d771 100644 --- a/packages/neon/neon/lib/src/blocs/push_notifications.dart +++ b/packages/neon/neon/lib/src/blocs/push_notifications.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; abstract class PushNotificationsBlocEvents {} diff --git a/packages/neon/neon/lib/src/blocs/timer.dart b/packages/neon/neon/lib/src/blocs/timer.dart index c19f327c..3e0098f8 100644 --- a/packages/neon/neon/lib/src/blocs/timer.dart +++ b/packages/neon/neon/lib/src/blocs/timer.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; abstract class TimerBlocEvents { /// Register a [callback] that will be called periodically. diff --git a/packages/neon/neon/lib/src/blocs/user_details.dart b/packages/neon/neon/lib/src/blocs/user_details.dart index 4227f76a..71e651d7 100644 --- a/packages/neon/neon/lib/src/blocs/user_details.dart +++ b/packages/neon/neon/lib/src/blocs/user_details.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; abstract class UserDetailsBlocEvents {} diff --git a/packages/neon/neon/lib/src/blocs/user_statuses.dart b/packages/neon/neon/lib/src/blocs/user_statuses.dart index 21b8803f..e00a705a 100644 --- a/packages/neon/neon/lib/src/blocs/user_statuses.dart +++ b/packages/neon/neon/lib/src/blocs/user_statuses.dart @@ -1,4 +1,4 @@ -part of '../../neon.dart'; +part of 'blocs.dart'; abstract class UserStatusesBlocEvents { void load(final String username, {final bool force = false});