1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-09 17:44:57 +09:00

Should not crash Android client when changing media block's background color on Desktop client (#900)

This commit is contained in:
Evgenii Kozlov 2020-09-22 19:44:11 +02:00 committed by GitHub
parent 6f30ecdca4
commit 4e3dfe5754
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 11 deletions

View file

@ -1,6 +1,6 @@
# Change log for Android @Anytype app.
## Version 0.0.48
## Version 0.0.48 (WIP)
### New features 🚀
@ -11,6 +11,10 @@
* Indent aware scroll-and-move (#820)
* Enter multi-select mode via document's main menu (#896)
### Fixes & tech 🚒
* Should not crash Android client when changing media block's background color on Desktop client (#814)
### Middleware ⚙
* Updated middleware protocol to `0.13.10` (#851)

View file

@ -32,17 +32,20 @@ class DocumentExternalEventReducer : StateReducer<List<Block>, Event> {
is Event.Command.DeleteBlock -> state.filter { !event.targets.contains(it.id) }
is Event.Command.GranularChange -> state.replace(
replacement = { block ->
val content = block.content<Block.Content.Text>()
block.copy(
content = content.copy(
style = event.style ?: content.style,
color = event.color ?: content.color,
backgroundColor = event.backgroundColor ?: content.backgroundColor,
text = event.text ?: content.text,
marks = event.marks ?: content.marks,
align = event.alignment
val content = block.content
if (content is Block.Content.Text)
block.copy(
content = content.copy(
style = event.style ?: content.style,
color = event.color ?: content.color,
backgroundColor = event.backgroundColor ?: content.backgroundColor,
text = event.text ?: content.text,
marks = event.marks ?: content.marks,
align = event.alignment
)
)
)
else
block.copy()
},
target = { block -> block.id == event.id }
)