|
@@ -23,26 +23,26 @@
|
|
package com.nextcloud.talk.data.source.local.converters
|
|
package com.nextcloud.talk.data.source.local.converters
|
|
|
|
|
|
import androidx.room.TypeConverter
|
|
import androidx.room.TypeConverter
|
|
|
|
+import com.bluelinelabs.logansquare.LoganSquare
|
|
import com.nextcloud.talk.models.json.push.PushConfigurationState
|
|
import com.nextcloud.talk.models.json.push.PushConfigurationState
|
|
|
|
|
|
class PushConfigurationConverter {
|
|
class PushConfigurationConverter {
|
|
- val json = JsonConfiguration.customJsonConfiguration
|
|
|
|
|
|
|
|
@TypeConverter
|
|
@TypeConverter
|
|
fun fromPushConfigurationToString(pushConfiguration: PushConfigurationState?): String {
|
|
fun fromPushConfigurationToString(pushConfiguration: PushConfigurationState?): String {
|
|
return if (pushConfiguration == null) {
|
|
return if (pushConfiguration == null) {
|
|
""
|
|
""
|
|
} else {
|
|
} else {
|
|
- json.encodeToString(PushConfigurationState.serializer(), pushConfiguration)
|
|
|
|
|
|
+ LoganSquare.serialize(pushConfiguration)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@TypeConverter
|
|
@TypeConverter
|
|
fun fromStringToPushConfiguration(value: String?): PushConfigurationState? {
|
|
fun fromStringToPushConfiguration(value: String?): PushConfigurationState? {
|
|
- if (value.isNullOrBlank()) {
|
|
|
|
- return null
|
|
|
|
|
|
+ return if (value.isNullOrBlank()) {
|
|
|
|
+ null
|
|
|
|
+ } else {
|
|
|
|
+ return LoganSquare.parse(value, PushConfigurationState::class.java)
|
|
}
|
|
}
|
|
-
|
|
|
|
- return json.decodeFromString(PushConfigurationState.serializer(), value)
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|