Caching channel info JSON parse in NoteCompose.

This commit is contained in:
Vitor Pamplona
2023-04-19 10:34:10 -04:00
parent b55f999efb
commit 744a55f497

View File

@@ -246,30 +246,32 @@ fun ChatroomMessageCompose(
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
val event = note.event val event = note.event
if (event is ChannelCreateEvent) { if (event is ChannelCreateEvent) {
val channelInfo = event.channelInfo()
Text( Text(
text = note.author?.toBestDisplayName() text = note.author?.toBestDisplayName()
.toString() + " ${stringResource(R.string.created)} " + ( .toString() + " ${stringResource(R.string.created)} " + (
event.channelInfo().name channelInfo.name
?: "" ?: ""
) + " ${stringResource(R.string.with_description_of)} '" + ( ) + " ${stringResource(R.string.with_description_of)} '" + (
event.channelInfo().about channelInfo.about
?: "" ?: ""
) + "', ${stringResource(R.string.and_picture)} '" + ( ) + "', ${stringResource(R.string.and_picture)} '" + (
event.channelInfo().picture channelInfo.picture
?: "" ?: ""
) + "'" ) + "'"
) )
} else if (event is ChannelMetadataEvent) { } else if (event is ChannelMetadataEvent) {
val channelInfo = event.channelInfo()
Text( Text(
text = note.author?.toBestDisplayName() text = note.author?.toBestDisplayName()
.toString() + " ${stringResource(R.string.changed_chat_name_to)} '" + ( .toString() + " ${stringResource(R.string.changed_chat_name_to)} '" + (
event.channelInfo().name channelInfo.name
?: "" ?: ""
) + "$', {stringResource(R.string.description_to)} '" + ( ) + "$', {stringResource(R.string.description_to)} '" + (
event.channelInfo().about channelInfo.about
?: "" ?: ""
) + "', ${stringResource(R.string.and_picture_to)} '" + ( ) + "', ${stringResource(R.string.and_picture_to)} '" + (
event.channelInfo().picture channelInfo.picture
?: "" ?: ""
) + "'" ) + "'"
) )