Skip to content

Commit f249570

Browse files
authored
Merge pull request #741 from tunjid/tj/notification-query-limit
Limit notifications fetched in NotificationQuery
2 parents d534210 + aaf1d7c commit f249570

File tree

2 files changed

+8
-1
lines changed
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository
  • feature/notifications/src/commonMain/kotlin/com/tunjid/heron/notifications

2 files changed

+8
-1
lines changed

data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/NotificationsRepository.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ import sh.christian.ozone.api.response.AtpResponse
5454
@Serializable
5555
data class NotificationsQuery(
5656
override val data: CursorQuery.Data,
57-
) : CursorQuery
57+
) : CursorQuery {
58+
init {
59+
require(data.limit < 20) {
60+
"Notification query limit must be less than 20 items"
61+
}
62+
}
63+
}
5864

5965
interface NotificationsRepository {
6066
val unreadCount: Flow<Long>

feature/notifications/src/commonMain/kotlin/com/tunjid/heron/notifications/State.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ data class State(
4545
data = CursorQuery.Data(
4646
page = 0,
4747
cursorAnchor = Clock.System.now(),
48+
limit = 18,
4849
),
4950
),
5051
),

0 commit comments

Comments
 (0)