diff --git a/packages/neon/neon/lib/neon.dart b/packages/neon/neon/lib/neon.dart index 18757966..e5fb2380 100644 --- a/packages/neon/neon/lib/neon.dart +++ b/packages/neon/neon/lib/neon.dart @@ -23,7 +23,6 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/models/account.dart'; import 'package:neon/src/models/push_notification.dart'; -import 'package:neon_notifications/neon_notifications.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:path/path.dart' as p; @@ -58,6 +57,7 @@ part 'src/blocs/next_push.dart'; part 'src/blocs/push_notifications.dart'; part 'src/blocs/user_details.dart'; part 'src/blocs/user_status.dart'; +part 'src/interfaces/notifications.dart'; part 'src/pages/account_settings.dart'; part 'src/pages/home.dart'; part 'src/pages/login.dart'; diff --git a/packages/neon/neon/lib/src/app.dart b/packages/neon/neon/lib/src/app.dart index a8f1aefc..a65778b0 100644 --- a/packages/neon/neon/lib/src/app.dart +++ b/packages/neon/neon/lib/src/app.dart @@ -173,7 +173,7 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra } final appImplementation = Provider.of>(context, listen: false) .singleWhere((final a) => a.id == 'notifications'); - await _accountsBloc.getAppsBloc(account).getAppBloc(appImplementation).refresh(); + await _accountsBloc.getAppsBloc(account).getAppBloc(appImplementation).refresh(); }; Global.onPushNotificationClicked = (final pushNotificationWithAccountID) async { final allAppImplementations = Provider.of>(context, listen: false); @@ -197,7 +197,7 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra if (appImplementation.id != 'notifications') { _accountsBloc .getAppsBloc(account) - .getAppBloc(appImplementation) + .getAppBloc(appImplementation) .deleteNotification(pushNotificationWithAccountID.subject.nid!); } await _openAppFromExternal(account, appImplementation.id); diff --git a/packages/neon/neon/lib/src/blocs/apps.dart b/packages/neon/neon/lib/src/blocs/apps.dart index 5cc65586..319eca16 100644 --- a/packages/neon/neon/lib/src/blocs/apps.dart +++ b/packages/neon/neon/lib/src/blocs/apps.dart @@ -11,7 +11,7 @@ abstract class AppsBlocStates { BehaviorSubject>> get appImplementations; - BehaviorSubject> get notificationsAppImplementation; + BehaviorSubject> get notificationsAppImplementation; BehaviorSubject get activeAppID; @@ -107,8 +107,8 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates BehaviorSubject>> apps = BehaviorSubject>>(); @override - BehaviorSubject> notificationsAppImplementation = - BehaviorSubject>(); + BehaviorSubject> notificationsAppImplementation = + BehaviorSubject>(); @override BehaviorSubject openNotifications = BehaviorSubject(); diff --git a/packages/neon/neon/lib/src/interfaces/notifications.dart b/packages/neon/neon/lib/src/interfaces/notifications.dart new file mode 100644 index 00000000..0f9a5de5 --- /dev/null +++ b/packages/neon/neon/lib/src/interfaces/notifications.dart @@ -0,0 +1,21 @@ +part of '../../neon.dart'; + +abstract class NotificationsAppInterface + extends AppImplementation { + NotificationsAppInterface( + super.sharedPreferences, + super.requestManager, + super.platform, + ); +} + +abstract class NotificationsBlocInterface extends InteractiveBloc { + NotificationsBlocInterface(this.options); + + final NotificationsOptionsInterface options; + void deleteNotification(final int id); +} + +abstract class NotificationsOptionsInterface extends NextcloudAppSpecificOptions { + NotificationsOptionsInterface(super.storage); +} diff --git a/packages/neon/neon/lib/src/pages/home.dart b/packages/neon/neon/lib/src/pages/home.dart index bdbd3498..f11c547c 100644 --- a/packages/neon/neon/lib/src/pages/home.dart +++ b/packages/neon/neon/lib/src/pages/home.dart @@ -147,7 +147,7 @@ class _HomePageState extends State { } Future _openNotifications( - final NotificationsApp app, + final NotificationsAppInterface app, final List accounts, final Account account, ) async { @@ -186,7 +186,7 @@ class _HomePageState extends State { stream: _capabilitiesBloc.capabilities, builder: (final context, final capabilities) => ResultBuilder>( stream: _appsBloc.appImplementations, - builder: (final context, final appImplementations) => ResultBuilder( + builder: (final context, final appImplementations) => ResultBuilder( stream: _appsBloc.notificationsAppImplementation, builder: (final context, final notificationsAppImplementation) => StreamBuilder( stream: _appsBloc.activeAppID, diff --git a/packages/neon/neon/pubspec.yaml b/packages/neon/neon/pubspec.yaml index 69079e1b..d7e361cf 100644 --- a/packages/neon/neon/pubspec.yaml +++ b/packages/neon/neon/pubspec.yaml @@ -24,8 +24,6 @@ dependencies: intl: ^0.17.0 json_annotation: ^4.7.0 material_design_icons_flutter: ^6.0.7096 - neon_notifications: - path: ../neon_notifications nextcloud: path: ../../nextcloud package_info_plus: ^1.4.2 diff --git a/packages/neon/neon_notifications/lib/blocs/notifications.dart b/packages/neon/neon_notifications/lib/blocs/notifications.dart index 909bbf50..e76b207d 100644 --- a/packages/neon/neon_notifications/lib/blocs/notifications.dart +++ b/packages/neon/neon_notifications/lib/blocs/notifications.dart @@ -12,9 +12,9 @@ abstract class NotificationsBlocStates { BehaviorSubject get unreadCounter; } -class NotificationsBloc extends InteractiveBloc implements NotificationsBlocEvents, NotificationsBlocStates { +class NotificationsBloc extends NotificationsBlocInterface implements NotificationsBlocEvents, NotificationsBlocStates { NotificationsBloc( - this.options, + super.options, this._requestManager, this._client, ) { @@ -27,7 +27,6 @@ class NotificationsBloc extends InteractiveBloc implements NotificationsBlocEven unawaited(refresh()); } - final NotificationsAppSpecificOptions options; final RequestManager _requestManager; final NextcloudClient _client; diff --git a/packages/neon/neon_notifications/lib/neon_notifications.dart b/packages/neon/neon_notifications/lib/neon_notifications.dart index a6ff8fa7..96d2ffe2 100644 --- a/packages/neon/neon_notifications/lib/neon_notifications.dart +++ b/packages/neon/neon_notifications/lib/neon_notifications.dart @@ -13,7 +13,7 @@ part 'blocs/notifications.dart'; part 'options.dart'; part 'pages/main.dart'; -class NotificationsApp extends AppImplementation { +class NotificationsApp extends NotificationsAppInterface { NotificationsApp(super.sharedPreferences, super.requestManager, super.platform); @override diff --git a/packages/neon/neon_notifications/lib/options.dart b/packages/neon/neon_notifications/lib/options.dart index 8801e95c..5bdd44e9 100644 --- a/packages/neon/neon_notifications/lib/options.dart +++ b/packages/neon/neon_notifications/lib/options.dart @@ -1,6 +1,6 @@ part of 'neon_notifications.dart'; -class NotificationsAppSpecificOptions extends NextcloudAppSpecificOptions { +class NotificationsAppSpecificOptions extends NotificationsOptionsInterface { NotificationsAppSpecificOptions(super.storage) { super.categories = []; super.options = [];