Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea7bc493 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

Revert "feature: Add InstantJsonParser class, to let moshi parse date from gitlab release API"

This reverts commit 61f34bfd.
and also remake the "release_at" field of GitlabReleaseInfo to String instead of Instant.
parent 2019ac8f
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import java.time.Instant
data class GitLabReleaseInfo(
    val name: String,
    @Json(name = "tag_name") val tagName: String,
    @Json(name = "released_at") val releasedAt: Instant,
    @Json(name = "released_at") val releasedAt: String,
    val assets: ReleaseAssets,
) {
    fun getAssetWebLink(assetName: String): String? {
+0 −21
Original line number Diff line number Diff line
package foundation.e.apps.di.network

import com.squareup.moshi.FromJson
import com.squareup.moshi.ToJson
import java.time.Instant
import java.time.format.DateTimeFormatter

//todo Instant is not available in Android API 25 which is the minimum used.
// 3 option: replace Instant by another class, use a third party library to make retrocompatibility
// or update android minimum api to at least API 26
class InstantJsonAdapter {
    @ToJson
    fun toJson(instant: Instant): String {
        return DateTimeFormatter.ISO_INSTANT.format(instant)
    }

    @FromJson
    fun fromJson(instantString: String): Instant {
        return Instant.parse(instantString)
    }
}
 No newline at end of file
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ object NetworkModule {
    @Provides
    fun getMoshi(): Moshi {
        return Moshi.Builder()
            .add(InstantJsonAdapter())
            .add(KotlinJsonAdapterFactory())
            .build()
    }