Skip to content

Commit

Permalink
Add digests field to return value of pending inbox items
Browse files Browse the repository at this point in the history
  • Loading branch information
holzmaster authored and mopsalarm committed Feb 21, 2024
1 parent 29f2bd4 commit e180f69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/pr0gramm/app/DebugConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var debugConfig = if (BuildConfig.DEBUG) actualDebugConfig else DebugConfig()

data class DebugConfig(
val ignoreUnreadState: Boolean = false,
val pendingNotifications: Api.Inbox? = null,
val pendingNotifications: Api.PendingInbox? = null,
val delayApiRequests: Boolean = false,
val mockApiUrl: String? = null,
val versionOverride: Int? = null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class InboxService(private val api: Api, private val preferences: SharedPreferen
suspend fun pending(): List<Message> {
val pending = debugConfig.pendingNotifications ?: api.inboxPending()

return convertInbox(pending, markAsRead = false) {
return convertInbox(Api.Inbox(pending.messages), markAsRead = false) {
it.toMessage()
}
}
Expand Down
8 changes: 7 additions & 1 deletion model/src/main/java/com/pr0gramm/app/api/pr0gramm/Api.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ interface Api {
): Info

@GET("/api/inbox/pending")
suspend fun inboxPending(): Inbox
suspend fun inboxPending(): PendingInbox

@GET("/api/inbox/conversations")
suspend fun listConversations(
Expand Down Expand Up @@ -652,6 +652,12 @@ interface Api {
)
}

@JsonClass(generateAdapter = true)
class PendingInbox (
val messages: List<Inbox.Item> = listOf(),
val digests: List<DigestsInbox.Digest> = listOf(),
)

@JsonClass(generateAdapter = true)
class DigestsInbox(val digests: List<Digest> = listOf()) {
@JsonClass(generateAdapter = true)
Expand Down

0 comments on commit e180f69

Please sign in to comment.