diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/chapter/ChapterRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/chapter/ChapterRepositoryImpl.kt index 76685eb3..87abea20 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/chapter/ChapterRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/chapter/ChapterRepositoryImpl.kt @@ -22,7 +22,7 @@ import com.apollographql.apollo.ApolloClient import com.apollographql.apollo.api.Optional import io.ktor.client.request.HttpRequestBuilder import io.ktor.client.request.get -import io.ktor.client.statement.readBytes +import io.ktor.client.statement.readRawBytes import io.ktor.http.Url import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow @@ -164,7 +164,7 @@ class ChapterRepositoryImpl( ): Flow { val realUrl = Url("$serverUrl$url") - return flow { emit(http.get(realUrl, block).readBytes()) } + return flow { emit(http.get(realUrl, block).readRawBytes()) } } companion object { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c27b298d..707ed1e9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -37,7 +37,7 @@ ksp = "2.2.20-2.0.3" kotlinInject = "0.7.2" # Network -ktor = "2.3.12" +ktor = "3.3.0" apollo = "4.0.0" apolloKtor = "0.0.2" diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt index e4bb26e6..b39e69cc 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt @@ -113,7 +113,7 @@ class TachideskPageLoader( flow { val response = getChapterPages.asFlow(page.url) { onDownload { bytesSentTotal, contentLength -> - page.progress.value = (bytesSentTotal.toFloat() / contentLength).coerceAtMost(1.0F) + page.progress.value = (bytesSentTotal.toFloat() / (contentLength ?: Long.MAX_VALUE)).coerceAtMost(1.0F) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt index fb5fcd19..309abf2c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt @@ -212,7 +212,7 @@ class SettingsBackupViewModel( ) { onDownload { bytesSentTotal, contentLength -> _creatingStatus.value = Status.InProgress( - (bytesSentTotal.toFloat() / contentLength) + (bytesSentTotal.toFloat() / (contentLength ?: Long.MAX_VALUE)) .coerceAtMost(0.99F), ) }