fix(#219): add pagination to sessions history tab (#357)

* fix(#219): add pagination to sessions history tab

The /api/sessions endpoint was called without pagination params, so the server returned only its default limit of 20 sessions.

- SessionListResponse: added total/limit/offset fields from server response
- HermesApiService: added @Query params (limit, offset, order) to getSessions()
- SessionsViewModel: added loadMore() that appends pages, hasMore derived from total
- SessionsScreen: added 'Load more sessions' button + loading spinner at bottom of list

* chore: remove plan file from git

* fix: compilation errors in sessions pagination

* chore: gitignore plan files

* fix: remove duplicate brace

---------

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-06-25 00:58:52 +03:00
1 parent 067f4500aa
commit 4ba74c2efa
7 files changed
+114 -7

No files matched your search

@@ -2,6 +2,9 @@ package com.m57.hermescontrol.data.model
data class SessionListResponse(
val sessions: List<SessionInfo>,
val total: Int = 0,
val limit: Int = 0,
val offset: Int = 0,
)
data class SessionInfo(
@@ -67,7 +67,11 @@ interface HermesApiService {
suspend fun getStatus(): Response<StatusResponse>
@GET("api/sessions")
suspend fun getSessions(): Response<SessionListResponse>
suspend fun getSessions(
@Query("limit") limit: Int = 20,
@Query("offset") offset: Int = 0,
@Query("order") order: String = "recent",
): Response<SessionListResponse>
@GET("api/sessions/{id}/messages")
suspend fun getSessionMessages(