Extract AddRecipeInput proto file to a module
This commit is contained in:
@@ -2,8 +2,8 @@ package gq.kirmanak.mealient.data.add.impl
|
||||
|
||||
import androidx.datastore.core.DataStore
|
||||
import gq.kirmanak.mealient.data.add.AddRecipeStorage
|
||||
import gq.kirmanak.mealient.data.add.models.AddRecipeInput
|
||||
import gq.kirmanak.mealient.data.add.models.AddRecipeRequest
|
||||
import gq.kirmanak.mealient.datastore.recipe.AddRecipeInput
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import timber.log.Timber
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package gq.kirmanak.mealient.data.add.models
|
||||
|
||||
import androidx.datastore.core.CorruptionException
|
||||
import androidx.datastore.core.Serializer
|
||||
import com.google.protobuf.InvalidProtocolBufferException
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
|
||||
object AddRecipeInputSerializer : Serializer<AddRecipeInput> {
|
||||
override val defaultValue: AddRecipeInput = AddRecipeInput.getDefaultInstance()
|
||||
|
||||
override suspend fun readFrom(input: InputStream): AddRecipeInput = try {
|
||||
AddRecipeInput.parseFrom(input)
|
||||
} catch (e: InvalidProtocolBufferException) {
|
||||
throw CorruptionException("Can't read proto file", e)
|
||||
}
|
||||
|
||||
override suspend fun writeTo(t: AddRecipeInput, output: OutputStream) = t.writeTo(output)
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package gq.kirmanak.mealient.data.add.models
|
||||
|
||||
import gq.kirmanak.mealient.datastore.recipe.AddRecipeInput
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
Reference in New Issue
Block a user