Formatting
This commit is contained in:
parent
dc402819d4
commit
d93504c072
|
@ -47,9 +47,9 @@ interface PixelfedAPI {
|
|||
)
|
||||
} as JsonDeserializer<Instant>).registerTypeAdapter(
|
||||
Instant::class.java,
|
||||
JsonSerializer { src: Instant, _,_ ->
|
||||
JsonPrimitive(DateTimeFormatter.ISO_INSTANT.format(src));
|
||||
})
|
||||
JsonSerializer { src: Instant, _, _ ->
|
||||
JsonPrimitive(DateTimeFormatter.ISO_INSTANT.format(src))
|
||||
})
|
||||
.create()
|
||||
|
||||
private val intermediate: Retrofit.Builder = Retrofit.Builder()
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.google.gson.Gson
|
|||
import com.google.gson.reflect.TypeToken
|
||||
import org.pixeldroid.app.utils.api.objects.*
|
||||
import java.time.Instant
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.*
|
||||
|
||||
|
@ -25,17 +24,6 @@ class Converters {
|
|||
fun fromInstant(time: Instant?): String? =
|
||||
time?.let { instantFormatter.format(it) }
|
||||
|
||||
@TypeConverter
|
||||
fun toOffsetDateTime(value: String?): OffsetDateTime? {
|
||||
return value?.let {
|
||||
return formatter.parse(it, OffsetDateTime::from)
|
||||
}
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun fromOffsetDateTime(date: OffsetDateTime?): String? {
|
||||
return date?.format(formatter)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun listToJson(list: List<String>): String = gson.toJson(list)
|
||||
|
|
Loading…
Reference in New Issue