Skip to content

Commit

Permalink
update ktor to 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Oct 10, 2024
1 parent e74e123 commit 67824b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ import io.ktor.client.statement.bodyAsChannel
import io.ktor.utils.io.core.isEmpty
import io.ktor.utils.io.core.readBytes
import io.ktor.utils.io.core.use
import io.ktor.utils.io.readRemaining
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.update
import kotlinx.io.readByteArray
import kotlinx.serialization.Serializable
import okhttp3.internal.closeQuietly
import okio.Path.Companion.toOkioPath
Expand Down Expand Up @@ -87,7 +89,7 @@ data object DownloadManager {
_progress.update {
Progress(
reached = bytesSentTotal,
length = max(bytesSentTotal, contentLength)
length = max(bytesSentTotal, contentLength ?: bytesSentTotal)
)
}
}
Expand All @@ -97,8 +99,8 @@ data object DownloadManager {
while (!channel.isClosedForRead) {
val packet = channel.readRemaining(BUFFER_SIZE)

while (!packet.isEmpty) {
val bytes = packet.readBytes()
while (!packet.exhausted()) {
val bytes = packet.readByteArray()

file.appendBytes(bytes)
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ konfig = "0.15.2"
kotlin = "2.0.20"
ksoup = "0.1.2"
ksp = "2.0.20-1.0.25"
ktor = "2.3.12"
ktor = "3.0.0"
ktorfit = "2.1.0"
media3 = "1.4.1"
moko-resources = "0.24.3"
Expand Down

0 comments on commit 67824b1

Please sign in to comment.