If you are using serialize name to like
@Keep
data class TagModel(
@SerializedName("created_by") val createdBy: String,
val name: String,
val created: Long = System.currentTimeMillis(),
) {
val formattedTime: String
get() = created.convertLongToTime(DateFormat.DD_MMM_YYYY.format)
}
@Keep
data class ResearchModel(
val title: String? = null,
val description: String? = null,
@PropertyName("created_by") @get:PropertyName("created_by") val createdBy: String? = null,
@PropertyName("created_by_uid") @get:PropertyName("created_by_uid") val createdByUID: String? = null,
val created: Long? = null,
@PropertyName("dead_line") @get:PropertyName("dead_line") val deadLine: Long? = null,
val tags: String? = null,
val key: String? = null
) {
val formattedTime: String
get() = created?.convertLongToTime(DateFormat.DD_MMM_YYYY.format) ?: "No Date"
val formattedDeadline: String
get() = deadLine?.convertLongToTime(DateFormat.DD_MMM_YYYY.format) ?: "No Deadline"
}
inline fun <reified T> fromJsonList(json: String): List<T> {
val gson = Gson()
val type = object : TypeToken<List<T>>() {}.type
return gson.fromJson(json, type)
}
you can use
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.reflect.TypeToken
# Optional. For using GSON @Expose annotation
-keepattributes AnnotationDefault,RuntimeVisibleAnnotations
-keepattributes Signature
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName <fields>;
}
-keep class com.atech.core.model.** { *; }
-keep class com.atech.core.utils.JsonKt { *; }
TypeToken
handling is explained. – Paschall