Room tag: let the tag order be anything to avoid breaking at the moment.
This commit is contained in:
parent
9cc2cf8360
commit
ca890e1ef4
|
@ -21,5 +21,5 @@ import com.squareup.moshi.JsonClass
|
|||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class RoomTagContent(
|
||||
@Json(name = "tags") val tags: Map<String, Map<String, Double>> = emptyMap()
|
||||
@Json(name = "tags") val tags: Map<String, Map<String, Any>> = emptyMap()
|
||||
)
|
||||
|
|
|
@ -32,15 +32,16 @@ internal class RoomTagHandler {
|
|||
val tags = ArrayList<RoomTagEntity>()
|
||||
for (tagName in content.tags.keys) {
|
||||
val params = content.tags[tagName]
|
||||
val tag = if (params != null) {
|
||||
RoomTagEntity(tagName, params["order"])
|
||||
val order = params?.get("order")
|
||||
val tag = if (order is Double) {
|
||||
RoomTagEntity(tagName, order)
|
||||
} else {
|
||||
RoomTagEntity(tagName, null)
|
||||
}
|
||||
tags.add(tag)
|
||||
}
|
||||
val roomSummaryEntity = RoomSummaryEntity.where(realm, roomId).findFirst()
|
||||
?: RoomSummaryEntity(roomId)
|
||||
?: RoomSummaryEntity(roomId)
|
||||
|
||||
roomSummaryEntity.tags.clear()
|
||||
roomSummaryEntity.tags.addAll(tags)
|
||||
|
|
Loading…
Reference in New Issue