Skip to content

Commit

Permalink
Increase notification API page size (#3839)
Browse files Browse the repository at this point in the history
Now notifications can be hidden by other notifications which might require that fetching 20 notifications isn't enough to fill one page. Thus increase the page size to 50.

Also see #3837

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma authored Dec 4, 2024
1 parent 540dcb0 commit 7838a53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.openhab.habdroid.core.connection.ConnectionFactory
import org.openhab.habdroid.core.connection.NotACloudServerException
import org.openhab.habdroid.model.CloudMessage
import org.openhab.habdroid.model.toCloudMessage
import org.openhab.habdroid.ui.CloudNotificationListFragment
import org.openhab.habdroid.ui.preference.PushNotificationStatus
import org.openhab.habdroid.util.HttpClient
import org.openhab.habdroid.util.PrefKeys
Expand Down Expand Up @@ -65,7 +66,7 @@ object CloudMessagingHelper {
}

private suspend fun loadNewMessages(context: Context, connection: Connection): List<CloudMessage>? {
val url = "api/v1/notifications?limit=20"
val url = "api/v1/notifications?limit=${CloudNotificationListFragment.PAGE_SIZE}"
val messages = try {
val response = connection.httpClient.get(url).asText().response
Log.d(TAG, "Notifications request success")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ class CloudNotificationListFragment : Fragment(), View.OnClickListener, SwipeRef
}

companion object {
private val TAG = CloudNotificationListFragment::class.java.simpleName
const val PAGE_SIZE = 50

private const val PAGE_SIZE = 20
private val TAG = CloudNotificationListFragment::class.java.simpleName

fun newInstance(highlightedId: String?, primaryServer: Boolean): CloudNotificationListFragment {
val f = CloudNotificationListFragment()
Expand Down

0 comments on commit 7838a53

Please sign in to comment.