mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-19 11:02:31 +01:00
Fix thumbnails not loading after url changes
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
package ca.gosyer.data.server
|
package ca.gosyer.data.server
|
||||||
|
|
||||||
import ca.gosyer.core.prefs.Preference
|
import ca.gosyer.core.prefs.Preference
|
||||||
|
import ca.gosyer.core.prefs.getAsFlow
|
||||||
import io.ktor.http.URLBuilder
|
import io.ktor.http.URLBuilder
|
||||||
import io.ktor.http.Url
|
import io.ktor.http.Url
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
@@ -14,6 +15,7 @@ import kotlinx.coroutines.flow.Flow
|
|||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.combine
|
import kotlinx.coroutines.flow.combine
|
||||||
|
import kotlinx.coroutines.flow.drop
|
||||||
import kotlinx.coroutines.flow.stateIn
|
import kotlinx.coroutines.flow.stateIn
|
||||||
|
|
||||||
class ServerUrlPreference(
|
class ServerUrlPreference(
|
||||||
@@ -58,14 +60,14 @@ class ServerUrlPreference(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun changes(): Flow<Url> {
|
override fun changes(): Flow<Url> {
|
||||||
return combine(server.changes(), port.changes(), pathPrefix.changes()) { server, port, pathPrefix ->
|
return combine(server.getAsFlow(), port.getAsFlow(), pathPrefix.getAsFlow()) { server, port, pathPrefix ->
|
||||||
URLBuilder(server).apply {
|
URLBuilder(server).apply {
|
||||||
this.port = port
|
this.port = port
|
||||||
if (pathPrefix.isNotBlank()) {
|
if (pathPrefix.isNotBlank()) {
|
||||||
path(pathPrefix)
|
path(pathPrefix)
|
||||||
}
|
}
|
||||||
}.build()
|
}.build()
|
||||||
}
|
}.drop(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stateIn(scope: CoroutineScope): StateFlow<Url> {
|
override fun stateIn(scope: CoroutineScope): StateFlow<Url> {
|
||||||
|
|||||||
Reference in New Issue
Block a user