mirror of
https://github.com/owenlejeune/TVTime.git
synced 2025-11-19 10:11:13 -05:00
fix some small bugs
This commit is contained in:
@@ -120,6 +120,11 @@ class TmdbClient: KoinComponent {
|
|||||||
builder.addQueryParams(languageParam, regionParam)
|
builder.addQueryParams(languageParam, regionParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shouldIncludeSessionIdParam(segments)) {
|
||||||
|
val sessionIdParam = QueryParam("session_id", SessionManager.currentSession.value!!.sessionId)
|
||||||
|
builder.addQueryParams(sessionIdParam)
|
||||||
|
}
|
||||||
|
|
||||||
val requestBuilder = chain.request().newBuilder().url(builder.build())
|
val requestBuilder = chain.request().newBuilder().url(builder.build())
|
||||||
|
|
||||||
val request = requestBuilder.build()
|
val request = requestBuilder.build()
|
||||||
@@ -151,6 +156,15 @@ class TmdbClient: KoinComponent {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun shouldIncludeSessionIdParam(urlSegments: List<String>): Boolean {
|
||||||
|
val includedRoutes = listOf("account_states")
|
||||||
|
for (route in includedRoutes) {
|
||||||
|
if (urlSegments.contains(route)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class V4Interceptor: Interceptor {
|
private inner class V4Interceptor: Interceptor {
|
||||||
|
|||||||
@@ -32,50 +32,41 @@ class AccountViewModel: ViewModel(), KoinComponent {
|
|||||||
|
|
||||||
val listMap = listService.listMap
|
val listMap = listService.listMap
|
||||||
|
|
||||||
val ratedTv: Flow<PagingData<Any>>
|
val ratedTv: Flow<PagingData<Any>> = createPagingFlow(
|
||||||
get() = createPagingFlow(
|
|
||||||
fetcher = { p -> accountV4Service.getRatedTvShows(accountId, p) },
|
fetcher = { p -> accountV4Service.getRatedTvShows(accountId, p) },
|
||||||
processor = { it.results }
|
processor = { it.results }
|
||||||
)
|
)
|
||||||
val favoriteTv: Flow<PagingData<Any>>
|
val favoriteTv: Flow<PagingData<Any>> = createPagingFlow(
|
||||||
get() = createPagingFlow(
|
|
||||||
fetcher = { p -> accountV4Service.getFavoriteTvShows(accountId, p) },
|
fetcher = { p -> accountV4Service.getFavoriteTvShows(accountId, p) },
|
||||||
processor = { it.results }
|
processor = { it.results }
|
||||||
)
|
)
|
||||||
val watchlistTv: Flow<PagingData<Any>>
|
val watchlistTv: Flow<PagingData<Any>> = createPagingFlow(
|
||||||
get() = createPagingFlow(
|
|
||||||
fetcher = { p -> accountV4Service.getTvShowWatchlist(accountId, p) },
|
fetcher = { p -> accountV4Service.getTvShowWatchlist(accountId, p) },
|
||||||
processor = { it.results }
|
processor = { it.results }
|
||||||
)
|
)
|
||||||
val recommendedTv: Flow<PagingData<Any>>
|
val recommendedTv: Flow<PagingData<Any>> = createPagingFlow(
|
||||||
get() = createPagingFlow(
|
|
||||||
fetcher = { p -> accountV4Service.getRecommendedTvSeries(accountId, p) },
|
fetcher = { p -> accountV4Service.getRecommendedTvSeries(accountId, p) },
|
||||||
processor = { it.results }
|
processor = { it.results }
|
||||||
)
|
)
|
||||||
|
|
||||||
val ratedMovies: Flow<PagingData<Any>>
|
val ratedMovies: Flow<PagingData<Any>> = createPagingFlow(
|
||||||
get() = createPagingFlow(
|
|
||||||
fetcher = { p -> accountV4Service.getRatedMovies(accountId, p) },
|
fetcher = { p -> accountV4Service.getRatedMovies(accountId, p) },
|
||||||
processor = { it.results }
|
processor = { it.results }
|
||||||
)
|
)
|
||||||
val favoriteMovies: Flow<PagingData<Any>>
|
val favoriteMovies: Flow<PagingData<Any>> = createPagingFlow(
|
||||||
get() = createPagingFlow(
|
|
||||||
fetcher = { p -> accountV4Service.getFavoriteMovies(accountId, p) },
|
fetcher = { p -> accountV4Service.getFavoriteMovies(accountId, p) },
|
||||||
processor = { it.results }
|
processor = { it.results }
|
||||||
)
|
)
|
||||||
val watchlistMovies: Flow<PagingData<Any>>
|
val watchlistMovies: Flow<PagingData<Any>> = createPagingFlow(
|
||||||
get() = createPagingFlow(
|
|
||||||
fetcher = { p -> accountV4Service.getMovieWatchlist(accountId, p) },
|
fetcher = { p -> accountV4Service.getMovieWatchlist(accountId, p) },
|
||||||
processor = { it.results }
|
processor = { it.results }
|
||||||
)
|
)
|
||||||
val recommendedMovies: Flow<PagingData<Any>>
|
val recommendedMovies: Flow<PagingData<Any>> = createPagingFlow(
|
||||||
get() = createPagingFlow(
|
|
||||||
fetcher = { p -> accountV4Service.getRecommendedMovies(accountId, p) },
|
fetcher = { p -> accountV4Service.getRecommendedMovies(accountId, p) },
|
||||||
processor = { it.results }
|
processor = { it.results }
|
||||||
)
|
)
|
||||||
|
|
||||||
val userLists: Flow<PagingData<Any>>
|
val userLists: Flow<PagingData<Any>> = createPagingFlow(
|
||||||
get() = createPagingFlow(
|
|
||||||
fetcher = { p -> accountV4Service.getLists(accountId, p) },
|
fetcher = { p -> accountV4Service.getLists(accountId, p) },
|
||||||
processor = { it.results }
|
processor = { it.results }
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user