Skip to content

Commit

Permalink
refactor(neon_notifications): Rename notifications list subject
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Feb 18, 2024
1 parent 493f8f4 commit e623d8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:neon_framework/blocs.dart';
import 'package:neon_framework/models.dart';
import 'package:neon_framework/utils.dart';
import 'package:neon_notifications/src/options.dart';
import 'package:nextcloud/notifications.dart' as notifications;
import 'package:nextcloud/notifications.dart' as $notifications;
import 'package:rxdart/rxdart.dart';

sealed class NotificationsBloc implements NotificationsBlocInterface, InteractiveBloc {
Expand All @@ -22,7 +22,7 @@ sealed class NotificationsBloc implements NotificationsBlocInterface, Interactiv

void deleteAllNotifications();

BehaviorSubject<Result<BuiltList<notifications.Notification>>> get notificationsList;
BehaviorSubject<Result<BuiltList<$notifications.Notification>>> get notifications;

BehaviorSubject<int> get unreadCounter;
}
Expand All @@ -32,7 +32,7 @@ class _NotificationsBloc extends InteractiveBloc implements NotificationsBlocInt
this.options,
this.account,
) {
notificationsList.listen((result) {
notifications.listen((result) {
if (result.hasData) {
unreadCounter.add(result.requireData.length);
}
Expand All @@ -49,13 +49,13 @@ class _NotificationsBloc extends InteractiveBloc implements NotificationsBlocInt
@override
void dispose() {
timer.cancel();
unawaited(notificationsList.close());
unawaited(notifications.close());
unawaited(unreadCounter.close());
super.dispose();
}

@override
final notificationsList = BehaviorSubject();
final notifications = BehaviorSubject();

@override
final unreadCounter = BehaviorSubject();
Expand All @@ -65,7 +65,7 @@ class _NotificationsBloc extends InteractiveBloc implements NotificationsBlocInt
await RequestManager.instance.wrapNextcloud(
account: account,
cacheKey: 'notifications-notifications',
subject: notificationsList,
subject: notifications,
rawResponse: account.client.notifications.endpoint.listNotificationsRaw(),
unwrap: (response) => response.body.ocs.data,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_notifications/lib/src/pages/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class _NotificationsMainPageState extends State<NotificationsMainPage> {

@override
Widget build(BuildContext context) => ResultBuilder.behaviorSubject(
subject: bloc.notificationsList,
subject: bloc.notifications,
builder: (context, notifications) => Scaffold(
resizeToAvoidBottomInset: false,
floatingActionButton: StreamBuilder(
Expand Down

0 comments on commit e623d8e

Please sign in to comment.