diff --git a/app/src/main/java/com/kelvinbush/nectar/data/repository/FruityRepositoryImpl.kt b/app/src/main/java/com/kelvinbush/nectar/data/repository/FruityRepositoryImpl.kt index 3421bed..2a2dd25 100644 --- a/app/src/main/java/com/kelvinbush/nectar/data/repository/FruityRepositoryImpl.kt +++ b/app/src/main/java/com/kelvinbush/nectar/data/repository/FruityRepositoryImpl.kt @@ -57,7 +57,6 @@ class FruityRepositoryImpl @Inject constructor( message = e.message.toString(), )) } catch (e: IOException) { - emit(Resource.Error( message = e.message.toString(), )) diff --git a/app/src/main/java/com/kelvinbush/nectar/domain/model/SignupUser.kt b/app/src/main/java/com/kelvinbush/nectar/domain/model/SignupUser.kt index 980d2bd..1799fc1 100644 --- a/app/src/main/java/com/kelvinbush/nectar/domain/model/SignupUser.kt +++ b/app/src/main/java/com/kelvinbush/nectar/domain/model/SignupUser.kt @@ -1,6 +1,8 @@ package com.kelvinbush.nectar.domain.model +import kotlinx.serialization.Serializable +@Serializable data class SignupUser( val name: String, val password: String, @@ -8,8 +10,7 @@ data class SignupUser( val email: String, ) +@Serializable data class Result( - val name: String, - val password: String, - val email: String, + val name: String ) diff --git a/app/src/main/java/com/kelvinbush/nectar/util/DefaultIfNull.kt b/app/src/main/java/com/kelvinbush/nectar/util/DefaultIfNull.kt deleted file mode 100644 index e1a4548..0000000 --- a/app/src/main/java/com/kelvinbush/nectar/util/DefaultIfNull.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.kelvinbush.nectar.util - -import com.squareup.moshi.* -import java.lang.reflect.Type - -@Retention(AnnotationRetention.RUNTIME) -@Target(AnnotationTarget.CLASS) -annotation class DefaultIfNull - -class DefaultIfNullFactory : JsonAdapter.Factory { - override fun create( - type: Type, annotations: MutableSet, - moshi: Moshi, - ): JsonAdapter<*>? { - if (!Types.getRawType(type).isAnnotationPresent(DefaultIfNull::class.java)) { - return null - } - - val delegate = moshi.nextAdapter(this, type, annotations) - - return object : JsonAdapter() { - override fun fromJson(reader: JsonReader): Any? { - @Suppress("UNCHECKED_CAST") - val blob = reader.readJsonValue() as Map - val noNulls = blob.filterValues { it != null } - return delegate.fromJsonValue(noNulls) - } - - override fun toJson(writer: JsonWriter, value: Any?) { - return delegate.toJson(writer, value) - } - } - } -} \ No newline at end of file