continue reborn :(
This commit is contained in:
@@ -3,6 +3,7 @@ plugins {
|
||||
id "org.jetbrains.kotlin.plugin.serialization"
|
||||
id "com.android.library"
|
||||
alias(libs.plugins.compose)
|
||||
alias(libs.plugins.kt.jb.compose)
|
||||
}
|
||||
|
||||
apply from: "$mppProjectWithSerializationPresetPath"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dev.inmo.postssystem.features.common.common
|
||||
|
||||
import dev.inmo.micro_utils.common.MPPFile
|
||||
import dev.inmo.micro_utils.common.filesize
|
||||
import io.ktor.utils.io.core.*
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.builtins.ByteArraySerializer
|
||||
@@ -27,9 +28,18 @@ class BytesBasedInputProvider(
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable(SimpleInputProviderSerializer::class)
|
||||
expect class FileBasedInputProvider : SimpleInputProvider {
|
||||
internal interface FileInputProvider : SimpleInputProvider {
|
||||
val file: MPPFile
|
||||
|
||||
override val contentBytes: Long?
|
||||
get() = file.filesize
|
||||
}
|
||||
|
||||
@Serializable(SimpleInputProviderSerializer::class)
|
||||
expect class FileBasedInputProvider : FileInputProvider {
|
||||
override val file: MPPFile
|
||||
|
||||
override fun invoke(): Input
|
||||
}
|
||||
|
||||
@Serializable(SimpleInputProviderSerializer::class)
|
||||
|
||||
@@ -7,12 +7,9 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable(SimpleInputProviderSerializer::class)
|
||||
actual class FileBasedInputProvider internal constructor(
|
||||
actual val file: MPPFile
|
||||
) : SimpleInputProvider {
|
||||
override val contentBytes: Long
|
||||
get() = file.filesize
|
||||
|
||||
override fun invoke(): Input = error("Files inputs must not be used directly")
|
||||
actual override val file: MPPFile
|
||||
) : FileInputProvider {
|
||||
actual override fun invoke(): Input = error("Files inputs must not be used directly")
|
||||
}
|
||||
|
||||
fun MPPFile.inputProvider() = FileBasedInputProvider(this)
|
||||
|
||||
@@ -8,10 +8,8 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable(SimpleInputProviderSerializer::class)
|
||||
actual class FileBasedInputProvider(
|
||||
actual val file: MPPFile
|
||||
) : SimpleInputProvider {
|
||||
override val contentBytes: Long?
|
||||
get() = file.filesize
|
||||
actual override val file: MPPFile
|
||||
) : FileInputProvider {
|
||||
|
||||
override fun invoke(): Input = file.inputStream().asInput()
|
||||
actual override fun invoke(): Input = file.inputStream().asInput()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user