From 30e28a978ff426f3237ab33b85a01d52cb4bdbc2 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Sat, 10 Jun 2023 15:12:53 +0200 Subject: [PATCH] neon, neon_notifications: fix generics of NotificationsAppInterface --- .../neon/neon/lib/src/interfaces/notifications.dart | 8 ++++---- .../neon_notifications/lib/blocs/notifications.dart | 11 +++++++---- .../neon_notifications/lib/neon_notifications.dart | 3 ++- packages/neon/neon_notifications/lib/options.dart | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/neon/neon/lib/src/interfaces/notifications.dart b/packages/neon/neon/lib/src/interfaces/notifications.dart index 0f9a5de5..a23c30fa 100644 --- a/packages/neon/neon/lib/src/interfaces/notifications.dart +++ b/packages/neon/neon/lib/src/interfaces/notifications.dart @@ -1,7 +1,7 @@ part of '../../neon.dart'; -abstract class NotificationsAppInterface - extends AppImplementation { +abstract interface class NotificationsAppInterface extends AppImplementation { NotificationsAppInterface( super.sharedPreferences, super.requestManager, @@ -9,13 +9,13 @@ abstract class NotificationsAppInterface ); } -abstract class NotificationsBlocInterface extends InteractiveBloc { +abstract interface class NotificationsBlocInterface extends InteractiveBloc { NotificationsBlocInterface(this.options); final NotificationsOptionsInterface options; void deleteNotification(final int id); } -abstract class NotificationsOptionsInterface extends NextcloudAppSpecificOptions { +abstract interface class NotificationsOptionsInterface extends NextcloudAppSpecificOptions { NotificationsOptionsInterface(super.storage); } diff --git a/packages/neon/neon_notifications/lib/blocs/notifications.dart b/packages/neon/neon_notifications/lib/blocs/notifications.dart index 460c5556..b52cf9ca 100644 --- a/packages/neon/neon_notifications/lib/blocs/notifications.dart +++ b/packages/neon/neon_notifications/lib/blocs/notifications.dart @@ -1,20 +1,21 @@ part of '../neon_notifications.dart'; -abstract class NotificationsBlocEvents { +abstract interface class NotificationsBlocEvents { void deleteNotification(final int id); void deleteAllNotifications(); } -abstract class NotificationsBlocStates { +abstract interface class NotificationsBlocStates { BehaviorSubject>> get notifications; BehaviorSubject get unreadCounter; } -class NotificationsBloc extends NotificationsBlocInterface implements NotificationsBlocEvents, NotificationsBlocStates { +class NotificationsBloc extends InteractiveBloc + implements NotificationsBlocInterface, NotificationsBlocEvents, NotificationsBlocStates { NotificationsBloc( - super.options, + this.options, this._requestManager, this._client, ) { @@ -27,6 +28,8 @@ class NotificationsBloc extends NotificationsBlocInterface implements Notificati unawaited(refresh()); } + @override + 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 f5a9b61f..83db56d7 100644 --- a/packages/neon/neon_notifications/lib/neon_notifications.dart +++ b/packages/neon/neon_notifications/lib/neon_notifications.dart @@ -14,7 +14,8 @@ part 'blocs/notifications.dart'; part 'options.dart'; part 'pages/main.dart'; -class NotificationsApp extends NotificationsAppInterface { +class NotificationsApp extends AppImplementation + implements 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 5bdd44e9..a897b3ff 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 NotificationsOptionsInterface { +class NotificationsAppSpecificOptions extends NextcloudAppSpecificOptions implements NotificationsOptionsInterface { NotificationsAppSpecificOptions(super.storage) { super.categories = []; super.options = [];