Browse Source

neon, neon_notifications: fix generics of NotificationsAppInterface

pull/371/head
Nikolas Rimikis 1 year ago
parent
commit
30e28a978f
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 8
      packages/neon/neon/lib/src/interfaces/notifications.dart
  2. 11
      packages/neon/neon_notifications/lib/blocs/notifications.dart
  3. 3
      packages/neon/neon_notifications/lib/neon_notifications.dart
  4. 2
      packages/neon/neon_notifications/lib/options.dart

8
packages/neon/neon/lib/src/interfaces/notifications.dart

@ -1,7 +1,7 @@
part of '../../neon.dart'; part of '../../neon.dart';
abstract class NotificationsAppInterface abstract interface class NotificationsAppInterface<T extends NotificationsBlocInterface,
extends AppImplementation<NotificationsBlocInterface, NotificationsOptionsInterface> { R extends NotificationsOptionsInterface> extends AppImplementation<T, R> {
NotificationsAppInterface( NotificationsAppInterface(
super.sharedPreferences, super.sharedPreferences,
super.requestManager, super.requestManager,
@ -9,13 +9,13 @@ abstract class NotificationsAppInterface
); );
} }
abstract class NotificationsBlocInterface extends InteractiveBloc { abstract interface class NotificationsBlocInterface extends InteractiveBloc {
NotificationsBlocInterface(this.options); NotificationsBlocInterface(this.options);
final NotificationsOptionsInterface options; final NotificationsOptionsInterface options;
void deleteNotification(final int id); void deleteNotification(final int id);
} }
abstract class NotificationsOptionsInterface extends NextcloudAppSpecificOptions { abstract interface class NotificationsOptionsInterface extends NextcloudAppSpecificOptions {
NotificationsOptionsInterface(super.storage); NotificationsOptionsInterface(super.storage);
} }

11
packages/neon/neon_notifications/lib/blocs/notifications.dart

@ -1,20 +1,21 @@
part of '../neon_notifications.dart'; part of '../neon_notifications.dart';
abstract class NotificationsBlocEvents { abstract interface class NotificationsBlocEvents {
void deleteNotification(final int id); void deleteNotification(final int id);
void deleteAllNotifications(); void deleteAllNotifications();
} }
abstract class NotificationsBlocStates { abstract interface class NotificationsBlocStates {
BehaviorSubject<Result<List<NextcloudNotificationsNotification>>> get notifications; BehaviorSubject<Result<List<NextcloudNotificationsNotification>>> get notifications;
BehaviorSubject<int> get unreadCounter; BehaviorSubject<int> get unreadCounter;
} }
class NotificationsBloc extends NotificationsBlocInterface implements NotificationsBlocEvents, NotificationsBlocStates { class NotificationsBloc extends InteractiveBloc
implements NotificationsBlocInterface, NotificationsBlocEvents, NotificationsBlocStates {
NotificationsBloc( NotificationsBloc(
super.options, this.options,
this._requestManager, this._requestManager,
this._client, this._client,
) { ) {
@ -27,6 +28,8 @@ class NotificationsBloc extends NotificationsBlocInterface implements Notificati
unawaited(refresh()); unawaited(refresh());
} }
@override
final NotificationsAppSpecificOptions options;
final RequestManager _requestManager; final RequestManager _requestManager;
final NextcloudClient _client; final NextcloudClient _client;

3
packages/neon/neon_notifications/lib/neon_notifications.dart

@ -14,7 +14,8 @@ part 'blocs/notifications.dart';
part 'options.dart'; part 'options.dart';
part 'pages/main.dart'; part 'pages/main.dart';
class NotificationsApp extends NotificationsAppInterface { class NotificationsApp extends AppImplementation<NotificationsBloc, NotificationsAppSpecificOptions>
implements NotificationsAppInterface<NotificationsBloc, NotificationsAppSpecificOptions> {
NotificationsApp(super.sharedPreferences, super.requestManager, super.platform); NotificationsApp(super.sharedPreferences, super.requestManager, super.platform);
@override @override

2
packages/neon/neon_notifications/lib/options.dart

@ -1,6 +1,6 @@
part of 'neon_notifications.dart'; part of 'neon_notifications.dart';
class NotificationsAppSpecificOptions extends NotificationsOptionsInterface { class NotificationsAppSpecificOptions extends NextcloudAppSpecificOptions implements NotificationsOptionsInterface {
NotificationsAppSpecificOptions(super.storage) { NotificationsAppSpecificOptions(super.storage) {
super.categories = []; super.categories = [];
super.options = []; super.options = [];

Loading…
Cancel
Save