mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-24 23:09:02 +03:00
Be more robust when parsing some enums
This commit is contained in:
parent
0f22dc610d
commit
a7539d0f95
2 changed files with 15 additions and 2 deletions
CHANGES.md
matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model
|
@ -11,6 +11,7 @@ Improvements 🙌:
|
||||||
- Improve message with Emoji only detection (#3017)
|
- Improve message with Emoji only detection (#3017)
|
||||||
- Picture preview when replying. Also add the image preview in the message detail bottomsheet (#2916)
|
- Picture preview when replying. Also add the image preview in the message detail bottomsheet (#2916)
|
||||||
- Api interceptor to allow app developers peek responses (#2986)
|
- Api interceptor to allow app developers peek responses (#2986)
|
||||||
|
- Be more robust when parsing some enums
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
- Fix bad theme change for the MainActivity
|
- Fix bad theme change for the MainActivity
|
||||||
|
|
|
@ -18,8 +18,20 @@ package org.matrix.android.sdk.api.session.room.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class RoomHistoryVisibilityContent(
|
data class RoomHistoryVisibilityContent(
|
||||||
@Json(name = "history_visibility") val historyVisibility: RoomHistoryVisibility? = null
|
@Json(name = "history_visibility") private val _historyVisibility: String? = null
|
||||||
)
|
) {
|
||||||
|
val historyVisibility: RoomHistoryVisibility? = when (_historyVisibility) {
|
||||||
|
"world_readable" -> RoomHistoryVisibility.WORLD_READABLE
|
||||||
|
"shared" -> RoomHistoryVisibility.SHARED
|
||||||
|
"invited" -> RoomHistoryVisibility.INVITED
|
||||||
|
"joined" -> RoomHistoryVisibility.JOINED
|
||||||
|
else -> {
|
||||||
|
Timber.w("Invalid value for RoomHistoryVisibility: `$_historyVisibility`")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue