Setup Presentation Module
This commit is contained in:
@@ -3,7 +3,7 @@ import de.fayard.refreshVersions.core.versionFor
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("kotlin-android")
|
||||
kotlin("plugin.serialization") version "1.5.21"
|
||||
kotlin("plugin.serialization") version "1.5.20"
|
||||
kotlin("kapt")
|
||||
}
|
||||
|
||||
@@ -41,8 +41,7 @@ dependencies {
|
||||
|
||||
api(Libs.ktor_client_core)
|
||||
api(Libs.ktor_serialization)
|
||||
|
||||
api(Libs.room_runtime)
|
||||
api(Libs.joda_time)
|
||||
|
||||
testImplementation(Libs.junit_jupiter_api)
|
||||
testImplementation(Libs.junit_jupiter_engine)
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ import kotlinx.serialization.Serializable
|
||||
@Entity
|
||||
data class Animator(
|
||||
@PrimaryKey
|
||||
val name: String = "",
|
||||
val avatarUrl: String = "",
|
||||
var name: String = "",
|
||||
var avatarUrl: String = "",
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
||||
+17
-12
@@ -2,6 +2,9 @@ package com.ericampire.android.androidstudycase.domain.entity
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import androidx.room.TypeConverters
|
||||
import com.ericampire.android.androidstudycase.domain.util.DateSerializer
|
||||
import com.ericampire.android.androidstudycase.util.room.DateConverter
|
||||
import kotlinx.serialization.Contextual
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -9,29 +12,31 @@ import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class BlogPage(
|
||||
val currentPage: Int,
|
||||
val from: Int,
|
||||
val perPage: Int,
|
||||
val blogs: List<Blog>,
|
||||
val to: Int,
|
||||
val total: Int,
|
||||
val totalPages: Int
|
||||
val currentPage: Int,
|
||||
val from: Int,
|
||||
val perPage: Int,
|
||||
val blogs: List<Blog>,
|
||||
val to: Int,
|
||||
val total: Int,
|
||||
val totalPages: Int
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class BlogData(
|
||||
@SerialName("blogs") val blogPage: BlogPage
|
||||
@SerialName("blogs") val blogPage: BlogPage
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class BlogApiResponse(
|
||||
@SerialName("data") val blogBlogData: BlogData
|
||||
@SerialName("data") val blogBlogData: BlogData
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@Entity
|
||||
data class Blog(
|
||||
@Contextual val postedAt: Date,
|
||||
@PrimaryKey val imageUrl: String,
|
||||
val title: String
|
||||
// @TypeConverters(DateConverter::class)
|
||||
// @Serializable(with = DateSerializer::class)
|
||||
var postedAt: String = "",
|
||||
@PrimaryKey val imageUrl: String = "",
|
||||
var title: String
|
||||
)
|
||||
+15
-14
@@ -1,14 +1,14 @@
|
||||
package com.ericampire.android.androidstudycase.domain.entity
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import androidx.room.*
|
||||
import com.ericampire.android.androidstudycase.domain.util.DateSerializer
|
||||
import com.ericampire.android.androidstudycase.util.room.DateConverter
|
||||
import kotlinx.serialization.Contextual
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import java.util.*
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonNames
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class LottieFilesApiResponse(
|
||||
@@ -16,10 +16,9 @@ data class LottieFilesApiResponse(
|
||||
val lottieFilesLottieFilesData: LottieFilesData
|
||||
)
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class LottieFilesData(
|
||||
@JsonNames("recent", "popular")
|
||||
@SerialName("recent")
|
||||
val page: LottieFilesPage
|
||||
)
|
||||
|
||||
@@ -39,15 +38,17 @@ data class LottieFilesPage(
|
||||
@Serializable
|
||||
@Entity
|
||||
class Lottiefile(
|
||||
@PrimaryKey val id: Long,
|
||||
val bgColor: String,
|
||||
val lottieUrl: String,
|
||||
val gifUrl: String,
|
||||
val videoUrl: String,
|
||||
val imageUrl: String,
|
||||
val name: String,
|
||||
@Contextual val createdAt: Date,
|
||||
val createdBy: Animator
|
||||
@PrimaryKey var id: Long? = null,
|
||||
var bgColor: String = "",
|
||||
var lottieUrl: String = "",
|
||||
var gifUrl: String = "",
|
||||
var videoUrl: String = "",
|
||||
var imageUrl: String = "",
|
||||
var name: String = "",
|
||||
// @TypeConverters(DateConverter::class)
|
||||
// @Serializable(with = DateSerializer::class)
|
||||
var createdAt: String = "",
|
||||
@Ignore var createdBy: Animator? = null
|
||||
)
|
||||
|
||||
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.ericampire.android.androidstudycase.domain.util
|
||||
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
|
||||
object DateSerializer : KSerializer<Date> {
|
||||
override val descriptor: SerialDescriptor
|
||||
get() = PrimitiveSerialDescriptor("Date", PrimitiveKind.STRING)
|
||||
|
||||
override fun serialize(encoder: Encoder, value: Date) {
|
||||
encoder.encodeString(DateTime(value).toString())
|
||||
}
|
||||
|
||||
override fun deserialize(decoder: Decoder): Date {
|
||||
return DateTime(decoder.decodeString()).toDate()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user