Skip to content

Commit e5a5bce

Browse files
committed
feat(account): add pagination support for in-app notifications
- Add loadingMore status to InAppNotificationCenterStatus enum - Extend InAppNotificationCenterState with pagination properties: - breakingNewsHasMore, breakingNewsCursor, digestHasMore, digestCursor - Update InAppNotificationCenterState copyWith method to include new parameters - Add comments explaining the new pagination-related properties
1 parent 838ac18 commit e5a5bce

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

lib/account/bloc/in_app_notification_center_state.dart

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ enum InAppNotificationCenterStatus {
88
/// The state when notifications are being loaded.
99
loading,
1010

11+
/// The state when more notifications are being loaded for pagination.
12+
loadingMore,
13+
1114
/// The state when notifications have been successfully loaded.
1215
success,
1316

@@ -25,6 +28,10 @@ class InAppNotificationCenterState extends Equatable {
2528
this.breakingNewsNotifications = const [],
2629
this.digestNotifications = const [],
2730
this.currentTabIndex = 0,
31+
this.breakingNewsHasMore = true,
32+
this.breakingNewsCursor,
33+
this.digestHasMore = true,
34+
this.digestCursor,
2835
this.error,
2936
});
3037

@@ -50,12 +57,28 @@ class InAppNotificationCenterState extends Equatable {
5057
/// An error that occurred during notification loading or processing.
5158
final HttpException? error;
5259

60+
/// A flag indicating if there are more breaking news notifications to fetch.
61+
final bool breakingNewsHasMore;
62+
63+
/// The cursor for fetching the next page of breaking news notifications.
64+
final String? breakingNewsCursor;
65+
66+
/// A flag indicating if there are more digest notifications to fetch.
67+
final bool digestHasMore;
68+
69+
/// The cursor for fetching the next page of digest notifications.
70+
final String? digestCursor;
71+
5372
@override
5473
List<Object> get props => [
5574
status,
5675
currentTabIndex,
5776
breakingNewsNotifications,
5877
digestNotifications,
78+
breakingNewsHasMore,
79+
breakingNewsCursor ?? Object(),
80+
digestHasMore,
81+
digestCursor ?? Object(),
5982
error ?? Object(), // Include error in props, handle nullability
6083
];
6184

@@ -67,6 +90,10 @@ class InAppNotificationCenterState extends Equatable {
6790
int? currentTabIndex,
6891
List<InAppNotification>? breakingNewsNotifications,
6992
List<InAppNotification>? digestNotifications,
93+
bool? breakingNewsHasMore,
94+
String? breakingNewsCursor,
95+
bool? digestHasMore,
96+
String? digestCursor,
7097
}) {
7198
return InAppNotificationCenterState(
7299
status: status ?? this.status,
@@ -75,6 +102,10 @@ class InAppNotificationCenterState extends Equatable {
75102
breakingNewsNotifications:
76103
breakingNewsNotifications ?? this.breakingNewsNotifications,
77104
digestNotifications: digestNotifications ?? this.digestNotifications,
105+
breakingNewsHasMore: breakingNewsHasMore ?? this.breakingNewsHasMore,
106+
breakingNewsCursor: breakingNewsCursor ?? this.breakingNewsCursor,
107+
digestHasMore: digestHasMore ?? this.digestHasMore,
108+
digestCursor: digestCursor ?? this.digestCursor,
78109
);
79110
}
80111
}

0 commit comments

Comments
 (0)