Unverified Commit 6c82cf20 authored by Leonardo Aramaki's avatar Leonardo Aramaki Committed by GitHub

Merge pull request #795 from RocketChat/fix-settings-lenient

Make SettingsAdapter lenient
parents 4c5fe904 25f854de
...@@ -6,16 +6,16 @@ import chat.rocket.android.server.domain.SettingsRepository ...@@ -6,16 +6,16 @@ import chat.rocket.android.server.domain.SettingsRepository
import chat.rocket.core.internal.SettingsAdapter import chat.rocket.core.internal.SettingsAdapter
import chat.rocket.core.model.Value import chat.rocket.core.model.Value
class SharedPreferencesSettingsRepository(private val localRespository: LocalRepository) : SettingsRepository { class SharedPreferencesSettingsRepository(private val localRepository: LocalRepository) : SettingsRepository {
private val adapter = SettingsAdapter() private val adapter = SettingsAdapter().lenient()
override fun save(url: String, settings: Map<String, Value<Any>>) { override fun save(url: String, settings: Map<String, Value<Any>>) {
localRespository.save("$SETTINGS_KEY$url", adapter.toJson(settings)) localRepository.save("$SETTINGS_KEY$url", adapter.toJson(settings))
} }
override fun get(url: String): Map<String, Value<Any>>? { override fun get(url: String): Map<String, Value<Any>>? {
val settings = localRespository.get("$SETTINGS_KEY$url") val settings = localRepository.get("$SETTINGS_KEY$url")
settings?.let { settings?.let {
return adapter.fromJson(it) return adapter.fromJson(it)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment