Add some app 131 migration code

This commit is contained in:
Mikołaj Pich 2023-08-23 20:19:47 +02:00
parent 8f5ee34610
commit 2caf2024a6

View file

@ -10,5 +10,16 @@ val json = Json {
}
fun generateJson(messages: List<Message>): String {
return json.encodeToString(messages)
return json.encodeToString(messages.addNewTypeMigration())
}
private fun List<Message>.addNewTypeMigration(): List<Message> {
return map {
if (!it.types.isNullOrEmpty()) {
it.copy(
// first app version, which correctly handles other types
versionMin = 131,
)
} else it
}
}