From cffb33d705358397fbc82fcc942bb622f87071f2 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Sun, 17 Mar 2019 07:57:10 +0100 Subject: [PATCH] fix proguard issue with NotificationTypeAdapter (#1129) --- .../keylesspalace/tusky/entity/Notification.kt | 14 +++++++++++++- .../tusky/json/NotificationTypeAdapter.kt | 18 ------------------ 2 files changed, 13 insertions(+), 19 deletions(-) delete mode 100644 app/src/main/java/com/keylesspalace/tusky/json/NotificationTypeAdapter.kt diff --git a/app/src/main/java/com/keylesspalace/tusky/entity/Notification.kt b/app/src/main/java/com/keylesspalace/tusky/entity/Notification.kt index 78f728a7..20f83a8b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/entity/Notification.kt +++ b/app/src/main/java/com/keylesspalace/tusky/entity/Notification.kt @@ -15,8 +15,11 @@ package com.keylesspalace.tusky.entity +import com.google.gson.JsonDeserializationContext +import com.google.gson.JsonDeserializer +import com.google.gson.JsonElement +import com.google.gson.JsonParseException import com.google.gson.annotations.JsonAdapter -import com.keylesspalace.tusky.json.NotificationTypeAdapter data class Notification( val type: Type, @@ -59,4 +62,13 @@ data class Notification( val notification = other as Notification? return notification?.id == this.id } + + class NotificationTypeAdapter : JsonDeserializer { + + @Throws(JsonParseException::class) + override fun deserialize(json: JsonElement, typeOfT: java.lang.reflect.Type, context: JsonDeserializationContext): Notification.Type { + return Notification.Type.byString(json.asString) + } + + } } diff --git a/app/src/main/java/com/keylesspalace/tusky/json/NotificationTypeAdapter.kt b/app/src/main/java/com/keylesspalace/tusky/json/NotificationTypeAdapter.kt deleted file mode 100644 index 44e47143..00000000 --- a/app/src/main/java/com/keylesspalace/tusky/json/NotificationTypeAdapter.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.keylesspalace.tusky.json - -import com.google.gson.JsonDeserializationContext -import com.google.gson.JsonDeserializer -import com.google.gson.JsonElement -import com.google.gson.JsonParseException -import com.keylesspalace.tusky.entity.Notification - -import java.lang.reflect.Type - -class NotificationTypeAdapter : JsonDeserializer { - - @Throws(JsonParseException::class) - override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): Notification.Type { - return Notification.Type.byString(json.asString) - } - -}