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';
abstract class NotificationsAppInterface
extends AppImplementation<NotificationsBlocInterface, NotificationsOptionsInterface> {
abstract interface class NotificationsAppInterface<T extends NotificationsBlocInterface,
R extends NotificationsOptionsInterface> extends AppImplementation<T, R> {
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);
}

11
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<Result<List<NextcloudNotificationsNotification>>> get notifications;
BehaviorSubject<int> 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;

3
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<NotificationsBloc, NotificationsAppSpecificOptions>
implements NotificationsAppInterface<NotificationsBloc, NotificationsAppSpecificOptions> {
NotificationsApp(super.sharedPreferences, super.requestManager, super.platform);
@override

2
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 = [];

Loading…
Cancel
Save