Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase notification API page size #3839

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading