fix proguard issue with NotificationTypeAdapter (#1129)
This commit is contained in:
parent
91492c4008
commit
612b90d93a
@ -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<Type> {
|
||||
|
||||
@Throws(JsonParseException::class)
|
||||
override fun deserialize(json: JsonElement, typeOfT: java.lang.reflect.Type, context: JsonDeserializationContext): Notification.Type {
|
||||
return Notification.Type.byString(json.asString)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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<Notification.Type> {
|
||||
|
||||
@Throws(JsonParseException::class)
|
||||
override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): Notification.Type {
|
||||
return Notification.Type.byString(json.asString)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user