autogestione fix: fetch limit, append, api call loop

This commit is contained in:
user 2023-11-12 20:43:36 +01:00
parent 4722ac0afc
commit bc6f0ff87d
3 changed files with 13 additions and 5 deletions

View file

@ -129,13 +129,17 @@ fun createTabDataFromId(id: String, arguments: List<String> = emptyList()): TabD
icon = R.drawable.ic_bookmark_active_24dp,
fragment = { TimelineFragment.newInstance(TimelineViewModel.Kind.BOOKMARKS) }
)
LOCAL -> TabData(
id = LOCAL,
text = R.string.title_public_local,
icon = R.drawable.ic_local_24dp,
fragment = { TimelineFragment.newInstance(TimelineViewModel.Kind.PUBLIC_LOCAL) }
)
AUTOGESTIONE -> TabData(
id = AUTOGESTIONE,
text = R.string.autogestione,
icon = R.drawable.ic_bullhorn_24dp,
fragment = { args -> TimelineFragment.newInstance(TimelineViewModel.Kind.AUTOGESTIONE, args.getOrNull(0).orEmpty()) },
arguments = arguments,
title = { arguments.getOrNull(1).orEmpty() }
fragment = { TimelineFragment.newInstance(TimelineViewModel.Kind.AUTOGESTIONE) }
)
else -> throw IllegalArgumentException("unknown tab type")
}

View file

@ -291,7 +291,7 @@ class NetworkTimelineViewModel @Inject constructor(
Kind.BOOKMARKS -> api.bookmarks(fromId, uptoId, limit)
Kind.LIST -> api.listTimeline(id!!, fromId, uptoId, limit)
Kind.PUBLIC_TRENDING_STATUSES -> api.trendingStatuses(limit = limit, offset = fromId)
Kind.AUTOGESTIONE -> api.autogestione(remote = false, only_media = false)
Kind.AUTOGESTIONE -> api.autogestione(remote = false, only_media = false,maxId = fromId, sinceId = uptoId, limit = limit)
}
}

View file

@ -864,6 +864,10 @@ interface MastodonApi {
@GET("/api/v1/timelines/autogestione?remote=false&only_media=false")
suspend fun autogestione(
@Query("remote") remote: Boolean? = false,
@Query("only_media") only_media: Boolean? = false
@Query("only_media") only_media: Boolean? = false,
@Query("local") local: Boolean? = null,
@Query("max_id") maxId: String? = null,
@Query("since_id") sinceId: String? = null,
@Query("limit") limit: Int? = null,
): Response<List<Status>>
}