Browse Source

neon: AppImplementation provide default getUnreadCounter

neon: simplify AppImplementation.getUnreadCounter interface
pull/387/head
Nikolas Rimikis 2 years ago
parent
commit
ffbfd191e0
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 3
      packages/neon/neon/lib/src/pages/home.dart
  2. 2
      packages/neon/neon/lib/src/utils/app_implementation.dart
  3. 3
      packages/neon/neon_files/lib/neon_files.dart
  4. 2
      packages/neon/neon_news/lib/neon_news.dart
  5. 3
      packages/neon/neon_notes/lib/neon_notes.dart
  6. 3
      packages/neon/neon_notifications/lib/neon_notifications.dart

3
packages/neon/neon/lib/src/pages/home.dart

@ -461,7 +461,8 @@ class _HomePageState extends State<HomePage> {
actions: [
if (notificationsAppImplementation.data != null) ...[
StreamBuilder<int>(
stream: notificationsAppImplementation.data!.getUnreadCounter(_appsBloc),
stream: notificationsAppImplementation.data!
.getUnreadCounter(notificationsAppImplementation.data!.getBloc(account)),
builder: (final context, final unreadCounterSnapshot) {
final unreadCount = unreadCounterSnapshot.data ?? 0;
return IconButton(

2
packages/neon/neon/lib/src/utils/app_implementation.dart

@ -37,7 +37,7 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppSpecificO
},
);
BehaviorSubject<int>? getUnreadCounter(final AppsBloc appsBloc);
BehaviorSubject<int>? getUnreadCounter(final T bloc) => null;
Widget get page;

3
packages/neon/neon_files/lib/neon_files.dart

@ -63,7 +63,4 @@ class FilesApp extends AppImplementation<FilesBloc, FilesAppSpecificOptions> {
@override
Widget get page => const FilesMainPage();
@override
BehaviorSubject<int>? getUnreadCounter(final AppsBloc appsBloc) => null;
}

2
packages/neon/neon_news/lib/neon_news.dart

@ -71,5 +71,5 @@ class NewsApp extends AppImplementation<NewsBloc, NewsAppSpecificOptions> {
Widget get page => const NewsMainPage();
@override
BehaviorSubject<int> getUnreadCounter(final AppsBloc appsBloc) => appsBloc.getAppBloc<NewsBloc>(this).unreadCounter;
BehaviorSubject<int> getUnreadCounter(final NewsBloc bloc) => bloc.unreadCounter;
}

3
packages/neon/neon_notes/lib/neon_notes.dart

@ -60,7 +60,4 @@ class NotesApp extends AppImplementation<NotesBloc, NotesAppSpecificOptions> {
@override
Widget get page => const NotesMainPage();
@override
BehaviorSubject<int>? getUnreadCounter(final AppsBloc appsBloc) => null;
}

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

@ -41,6 +41,5 @@ class NotificationsApp extends AppImplementation<NotificationsBloc, Notification
Widget get page => const NotificationsMainPage();
@override
BehaviorSubject<int> getUnreadCounter(final AppsBloc appsBloc) =>
appsBloc.getAppBloc<NotificationsBloc>(this).unreadCounter;
BehaviorSubject<int> getUnreadCounter(final NotificationsBloc bloc) => bloc.unreadCounter;
}

Loading…
Cancel
Save