kopia lustrzana https://github.com/vitorpamplona/amethyst
Correctly moving the Reply line out of the renderer.
rodzic
e898d58239
commit
8125a7dabb
|
@ -29,7 +29,6 @@ import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
@ -85,6 +84,7 @@ import com.vitorpamplona.amethyst.ui.note.types.RenderAppDefinition
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderAudioHeader
|
import com.vitorpamplona.amethyst.ui.note.types.RenderAudioHeader
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderAudioTrack
|
import com.vitorpamplona.amethyst.ui.note.types.RenderAudioTrack
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderBadgeAward
|
import com.vitorpamplona.amethyst.ui.note.types.RenderBadgeAward
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.types.RenderChannelMessage
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderChatMessage
|
import com.vitorpamplona.amethyst.ui.note.types.RenderChatMessage
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderClassifieds
|
import com.vitorpamplona.amethyst.ui.note.types.RenderClassifieds
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderEmojiPack
|
import com.vitorpamplona.amethyst.ui.note.types.RenderEmojiPack
|
||||||
|
@ -121,7 +121,6 @@ import com.vitorpamplona.amethyst.ui.theme.Size34dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size55Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size55Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
|
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
|
||||||
import com.vitorpamplona.amethyst.ui.theme.UserNameMaxRowHeight
|
import com.vitorpamplona.amethyst.ui.theme.UserNameMaxRowHeight
|
||||||
import com.vitorpamplona.amethyst.ui.theme.UserNameRowHeight
|
import com.vitorpamplona.amethyst.ui.theme.UserNameRowHeight
|
||||||
import com.vitorpamplona.amethyst.ui.theme.WidthAuthorPictureModifier
|
import com.vitorpamplona.amethyst.ui.theme.WidthAuthorPictureModifier
|
||||||
|
@ -171,8 +170,6 @@ import com.vitorpamplona.quartz.events.TextNoteModificationEvent
|
||||||
import com.vitorpamplona.quartz.events.VideoHorizontalEvent
|
import com.vitorpamplona.quartz.events.VideoHorizontalEvent
|
||||||
import com.vitorpamplona.quartz.events.VideoVerticalEvent
|
import com.vitorpamplona.quartz.events.VideoVerticalEvent
|
||||||
import com.vitorpamplona.quartz.events.WikiNoteEvent
|
import com.vitorpamplona.quartz.events.WikiNoteEvent
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -528,16 +525,6 @@ fun NoteBody(
|
||||||
Spacer(modifier = Modifier.height(3.dp))
|
Spacer(modifier = Modifier.height(3.dp))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!makeItShort) {
|
|
||||||
ReplyRow(
|
|
||||||
baseNote,
|
|
||||||
unPackReply,
|
|
||||||
backgroundColor,
|
|
||||||
accountViewModel,
|
|
||||||
nav,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderNoteRow(
|
RenderNoteRow(
|
||||||
baseNote = baseNote,
|
baseNote = baseNote,
|
||||||
backgroundColor = backgroundColor,
|
backgroundColor = backgroundColor,
|
||||||
|
@ -545,6 +532,7 @@ fun NoteBody(
|
||||||
canPreview = canPreview,
|
canPreview = canPreview,
|
||||||
editState = editState,
|
editState = editState,
|
||||||
quotesLeft = quotesLeft,
|
quotesLeft = quotesLeft,
|
||||||
|
unPackReply = unPackReply,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
)
|
)
|
||||||
|
@ -564,6 +552,7 @@ private fun RenderNoteRow(
|
||||||
makeItShort: Boolean,
|
makeItShort: Boolean,
|
||||||
canPreview: Boolean,
|
canPreview: Boolean,
|
||||||
quotesLeft: Int,
|
quotesLeft: Int,
|
||||||
|
unPackReply: Boolean,
|
||||||
editState: State<GenericLoadable<EditState>>,
|
editState: State<GenericLoadable<EditState>>,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
|
@ -658,6 +647,7 @@ private fun RenderNoteRow(
|
||||||
makeItShort,
|
makeItShort,
|
||||||
canPreview,
|
canPreview,
|
||||||
quotesLeft,
|
quotesLeft,
|
||||||
|
unPackReply,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
nav,
|
nav,
|
||||||
|
@ -687,6 +677,17 @@ private fun RenderNoteRow(
|
||||||
nav,
|
nav,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
is ChannelMessageEvent ->
|
||||||
|
RenderChannelMessage(
|
||||||
|
baseNote,
|
||||||
|
makeItShort,
|
||||||
|
canPreview,
|
||||||
|
quotesLeft,
|
||||||
|
backgroundColor,
|
||||||
|
editState,
|
||||||
|
accountViewModel,
|
||||||
|
nav,
|
||||||
|
)
|
||||||
is LiveActivitiesChatMessageEvent ->
|
is LiveActivitiesChatMessageEvent ->
|
||||||
RenderLiveActivityChatMessage(
|
RenderLiveActivityChatMessage(
|
||||||
baseNote,
|
baseNote,
|
||||||
|
@ -704,6 +705,7 @@ private fun RenderNoteRow(
|
||||||
makeItShort,
|
makeItShort,
|
||||||
canPreview,
|
canPreview,
|
||||||
quotesLeft,
|
quotesLeft,
|
||||||
|
unPackReply,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
editState,
|
editState,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
@ -748,14 +750,6 @@ fun RenderDraft(
|
||||||
ObserveDraftEvent(note, accountViewModel) {
|
ObserveDraftEvent(note, accountViewModel) {
|
||||||
val edits = remember { mutableStateOf(GenericLoadable.Empty<EditState>()) }
|
val edits = remember { mutableStateOf(GenericLoadable.Empty<EditState>()) }
|
||||||
|
|
||||||
ReplyRow(
|
|
||||||
it,
|
|
||||||
true,
|
|
||||||
backgroundColor,
|
|
||||||
accountViewModel,
|
|
||||||
nav,
|
|
||||||
)
|
|
||||||
|
|
||||||
RenderNoteRow(
|
RenderNoteRow(
|
||||||
baseNote = it,
|
baseNote = it,
|
||||||
backgroundColor = backgroundColor,
|
backgroundColor = backgroundColor,
|
||||||
|
@ -763,6 +757,7 @@ fun RenderDraft(
|
||||||
canPreview = true,
|
canPreview = true,
|
||||||
editState = edits,
|
editState = edits,
|
||||||
quotesLeft = 3,
|
quotesLeft = 3,
|
||||||
|
unPackReply = true,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
)
|
)
|
||||||
|
@ -808,81 +803,7 @@ fun getGradient(backgroundColor: MutableState<Color>): Brush {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ReplyRow(
|
fun ReplyNoteComposition(
|
||||||
note: Note,
|
|
||||||
unPackReply: Boolean,
|
|
||||||
backgroundColor: MutableState<Color>,
|
|
||||||
accountViewModel: AccountViewModel,
|
|
||||||
nav: (String) -> Unit,
|
|
||||||
) {
|
|
||||||
val noteEvent = note.event
|
|
||||||
|
|
||||||
val showReply by
|
|
||||||
remember(note) {
|
|
||||||
derivedStateOf {
|
|
||||||
noteEvent is BaseTextNoteEvent && (note.replyTo != null || noteEvent.hasAnyTaggedUser())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val showChannelInfo by
|
|
||||||
remember(note) {
|
|
||||||
derivedStateOf {
|
|
||||||
if (noteEvent is ChannelMessageEvent || noteEvent is LiveActivitiesChatMessageEvent) {
|
|
||||||
note.channelHex()
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
showChannelInfo?.let {
|
|
||||||
ChannelHeader(
|
|
||||||
channelHex = it,
|
|
||||||
showVideo = false,
|
|
||||||
sendToChannel = true,
|
|
||||||
modifier = MaterialTheme.colorScheme.replyModifier.padding(10.dp),
|
|
||||||
accountViewModel = accountViewModel,
|
|
||||||
nav = nav,
|
|
||||||
)
|
|
||||||
Spacer(modifier = StdVertSpacer)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showReply) {
|
|
||||||
val replyingDirectlyTo =
|
|
||||||
remember(note) {
|
|
||||||
if (noteEvent is BaseTextNoteEvent) {
|
|
||||||
val replyingTo = noteEvent.replyingToAddressOrEvent()
|
|
||||||
if (replyingTo != null) {
|
|
||||||
val newNote = accountViewModel.getNoteIfExists(replyingTo)
|
|
||||||
if (newNote != null && newNote.channelHex() == null && newNote.event?.kind() != CommunityDefinitionEvent.KIND) {
|
|
||||||
newNote
|
|
||||||
} else {
|
|
||||||
note.replyTo?.lastOrNull { it.event?.kind() != CommunityDefinitionEvent.KIND }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
note.replyTo?.lastOrNull { it.event?.kind() != CommunityDefinitionEvent.KIND }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
note.replyTo?.lastOrNull { it.event?.kind() != CommunityDefinitionEvent.KIND }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (replyingDirectlyTo != null && unPackReply) {
|
|
||||||
ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav)
|
|
||||||
Spacer(modifier = StdVertSpacer)
|
|
||||||
} else if (showChannelInfo != null) {
|
|
||||||
val replies = remember { note.replyTo?.toImmutableList() }
|
|
||||||
val mentions =
|
|
||||||
remember {
|
|
||||||
(note.event as? BaseTextNoteEvent)?.mentions()?.toImmutableList() ?: persistentListOf()
|
|
||||||
}
|
|
||||||
|
|
||||||
ReplyInformationChannel(replies, mentions, accountViewModel, nav)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun ReplyNoteComposition(
|
|
||||||
replyingDirectlyTo: Note,
|
replyingDirectlyTo: Note,
|
||||||
backgroundColor: MutableState<Color>,
|
backgroundColor: MutableState<Color>,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2024 Vitor Pamplona
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to use,
|
||||||
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||||
|
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||||
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
package com.vitorpamplona.amethyst.ui.note.types
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.MutableState
|
||||||
|
import androidx.compose.runtime.State
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
|
import com.vitorpamplona.amethyst.ui.components.GenericLoadable
|
||||||
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ChannelHeader
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.replyModifier
|
||||||
|
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun RenderChannelMessage(
|
||||||
|
note: Note,
|
||||||
|
makeItShort: Boolean,
|
||||||
|
canPreview: Boolean,
|
||||||
|
quotesLeft: Int,
|
||||||
|
backgroundColor: MutableState<Color>,
|
||||||
|
editState: State<GenericLoadable<EditState>>,
|
||||||
|
accountViewModel: AccountViewModel,
|
||||||
|
nav: (String) -> Unit,
|
||||||
|
) {
|
||||||
|
val noteEvent = note.event
|
||||||
|
val showChannelInfo =
|
||||||
|
remember(noteEvent) {
|
||||||
|
if (noteEvent is ChannelMessageEvent) {
|
||||||
|
noteEvent.channel()
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
showChannelInfo?.let {
|
||||||
|
ChannelHeader(
|
||||||
|
channelHex = it,
|
||||||
|
showVideo = false,
|
||||||
|
sendToChannel = true,
|
||||||
|
modifier = MaterialTheme.colorScheme.replyModifier.padding(10.dp),
|
||||||
|
accountViewModel = accountViewModel,
|
||||||
|
nav = nav,
|
||||||
|
)
|
||||||
|
Spacer(modifier = StdVertSpacer)
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderTextEvent(
|
||||||
|
note,
|
||||||
|
makeItShort,
|
||||||
|
canPreview,
|
||||||
|
quotesLeft,
|
||||||
|
unPackReply = false,
|
||||||
|
backgroundColor,
|
||||||
|
editState,
|
||||||
|
accountViewModel,
|
||||||
|
nav,
|
||||||
|
)
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.ui.components.GenericLoadable
|
import com.vitorpamplona.amethyst.ui.components.GenericLoadable
|
||||||
|
import com.vitorpamplona.amethyst.ui.navigation.routeFor
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ChatroomHeader
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ChatroomHeader
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
||||||
|
@ -59,7 +60,11 @@ fun RenderChatMessage(
|
||||||
|
|
||||||
userRoom?.let {
|
userRoom?.let {
|
||||||
if (it.users.size > 1 || (it.users.size == 1 && note.author == accountViewModel.account.userProfile())) {
|
if (it.users.size > 1 || (it.users.size == 1 && note.author == accountViewModel.account.userProfile())) {
|
||||||
ChatroomHeader(it, MaterialTheme.colorScheme.replyModifier.padding(10.dp), accountViewModel, nav)
|
ChatroomHeader(it, MaterialTheme.colorScheme.replyModifier.padding(10.dp), accountViewModel) {
|
||||||
|
routeFor(note, accountViewModel.userProfile())?.let {
|
||||||
|
nav(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
Spacer(modifier = StdVertSpacer)
|
Spacer(modifier = StdVertSpacer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +74,7 @@ fun RenderChatMessage(
|
||||||
makeItShort,
|
makeItShort,
|
||||||
canPreview,
|
canPreview,
|
||||||
quotesLeft,
|
quotesLeft,
|
||||||
|
unPackReply = false,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
editState,
|
editState,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
|
|
@ -76,6 +76,7 @@ fun RenderLiveActivityChatMessage(
|
||||||
makeItShort,
|
makeItShort,
|
||||||
canPreview,
|
canPreview,
|
||||||
quotesLeft,
|
quotesLeft,
|
||||||
|
unPackReply = false,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
editState,
|
editState,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
|
|
@ -20,11 +20,14 @@
|
||||||
*/
|
*/
|
||||||
package com.vitorpamplona.amethyst.ui.note.types
|
package com.vitorpamplona.amethyst.ui.note.types
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
|
import androidx.compose.runtime.derivedStateOf
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
@ -33,9 +36,13 @@ import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
||||||
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
||||||
import com.vitorpamplona.amethyst.ui.note.PollNote
|
import com.vitorpamplona.amethyst.ui.note.PollNote
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.ReplyNoteComposition
|
||||||
import com.vitorpamplona.amethyst.ui.note.elements.DisplayUncitedHashtags
|
import com.vitorpamplona.amethyst.ui.note.elements.DisplayUncitedHashtags
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
|
import com.vitorpamplona.quartz.events.BaseTextNoteEvent
|
||||||
|
import com.vitorpamplona.quartz.events.CommunityDefinitionEvent
|
||||||
import com.vitorpamplona.quartz.events.EmptyTagList
|
import com.vitorpamplona.quartz.events.EmptyTagList
|
||||||
import com.vitorpamplona.quartz.events.PollNoteEvent
|
import com.vitorpamplona.quartz.events.PollNoteEvent
|
||||||
import com.vitorpamplona.quartz.events.toImmutableListOfLists
|
import com.vitorpamplona.quartz.events.toImmutableListOfLists
|
||||||
|
@ -47,6 +54,7 @@ fun RenderPoll(
|
||||||
makeItShort: Boolean,
|
makeItShort: Boolean,
|
||||||
canPreview: Boolean,
|
canPreview: Boolean,
|
||||||
quotesLeft: Int,
|
quotesLeft: Int,
|
||||||
|
unPackReply: Boolean,
|
||||||
backgroundColor: MutableState<Color>,
|
backgroundColor: MutableState<Color>,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
|
@ -54,6 +62,38 @@ fun RenderPoll(
|
||||||
val noteEvent = note.event as? PollNoteEvent ?: return
|
val noteEvent = note.event as? PollNoteEvent ?: return
|
||||||
val eventContent = noteEvent.content()
|
val eventContent = noteEvent.content()
|
||||||
|
|
||||||
|
val showReply by
|
||||||
|
remember(note) {
|
||||||
|
derivedStateOf {
|
||||||
|
noteEvent is BaseTextNoteEvent && !makeItShort && unPackReply && (note.replyTo != null || noteEvent.hasAnyTaggedUser())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showReply) {
|
||||||
|
val replyingDirectlyTo =
|
||||||
|
remember(note) {
|
||||||
|
if (noteEvent is BaseTextNoteEvent) {
|
||||||
|
val replyingTo = noteEvent.replyingToAddressOrEvent()
|
||||||
|
if (replyingTo != null) {
|
||||||
|
val newNote = accountViewModel.getNoteIfExists(replyingTo)
|
||||||
|
if (newNote != null && newNote.channelHex() == null && newNote.event?.kind() != CommunityDefinitionEvent.KIND) {
|
||||||
|
newNote
|
||||||
|
} else {
|
||||||
|
note.replyTo?.lastOrNull { it.event?.kind() != CommunityDefinitionEvent.KIND }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
note.replyTo?.lastOrNull { it.event?.kind() != CommunityDefinitionEvent.KIND }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
note.replyTo?.lastOrNull { it.event?.kind() != CommunityDefinitionEvent.KIND }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (replyingDirectlyTo != null) {
|
||||||
|
ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav)
|
||||||
|
Spacer(modifier = StdVertSpacer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (makeItShort && accountViewModel.isLoggedUser(note.author)) {
|
if (makeItShort && accountViewModel.isLoggedUser(note.author)) {
|
||||||
Text(
|
Text(
|
||||||
text = eventContent,
|
text = eventContent,
|
||||||
|
|
|
@ -39,6 +39,7 @@ import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
||||||
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
||||||
|
import com.vitorpamplona.amethyst.ui.navigation.routeFor
|
||||||
import com.vitorpamplona.amethyst.ui.note.LoadDecryptedContent
|
import com.vitorpamplona.amethyst.ui.note.LoadDecryptedContent
|
||||||
import com.vitorpamplona.amethyst.ui.note.elements.DisplayUncitedHashtags
|
import com.vitorpamplona.amethyst.ui.note.elements.DisplayUncitedHashtags
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
@ -75,7 +76,11 @@ fun RenderPrivateMessage(
|
||||||
|
|
||||||
userRoom?.let {
|
userRoom?.let {
|
||||||
if (it.users.size > 1 || (it.users.size == 1 && note.author == accountViewModel.account.userProfile())) {
|
if (it.users.size > 1 || (it.users.size == 1 && note.author == accountViewModel.account.userProfile())) {
|
||||||
ChatroomHeader(it, MaterialTheme.colorScheme.replyModifier.padding(10.dp), accountViewModel, nav)
|
ChatroomHeader(it, MaterialTheme.colorScheme.replyModifier.padding(10.dp), accountViewModel) {
|
||||||
|
routeFor(note, accountViewModel.userProfile())?.let {
|
||||||
|
nav(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
Spacer(modifier = StdVertSpacer)
|
Spacer(modifier = StdVertSpacer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
package com.vitorpamplona.amethyst.ui.note.types
|
package com.vitorpamplona.amethyst.ui.note.types
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
@ -37,9 +38,13 @@ import com.vitorpamplona.amethyst.ui.components.GenericLoadable
|
||||||
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
||||||
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
||||||
import com.vitorpamplona.amethyst.ui.note.LoadDecryptedContent
|
import com.vitorpamplona.amethyst.ui.note.LoadDecryptedContent
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.ReplyNoteComposition
|
||||||
import com.vitorpamplona.amethyst.ui.note.elements.DisplayUncitedHashtags
|
import com.vitorpamplona.amethyst.ui.note.elements.DisplayUncitedHashtags
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
|
import com.vitorpamplona.quartz.events.BaseTextNoteEvent
|
||||||
|
import com.vitorpamplona.quartz.events.CommunityDefinitionEvent
|
||||||
import com.vitorpamplona.quartz.events.EmptyTagList
|
import com.vitorpamplona.quartz.events.EmptyTagList
|
||||||
import com.vitorpamplona.quartz.events.TextNoteEvent
|
import com.vitorpamplona.quartz.events.TextNoteEvent
|
||||||
import com.vitorpamplona.quartz.events.toImmutableListOfLists
|
import com.vitorpamplona.quartz.events.toImmutableListOfLists
|
||||||
|
@ -52,11 +57,46 @@ fun RenderTextEvent(
|
||||||
makeItShort: Boolean,
|
makeItShort: Boolean,
|
||||||
canPreview: Boolean,
|
canPreview: Boolean,
|
||||||
quotesLeft: Int,
|
quotesLeft: Int,
|
||||||
|
unPackReply: Boolean,
|
||||||
backgroundColor: MutableState<Color>,
|
backgroundColor: MutableState<Color>,
|
||||||
editState: State<GenericLoadable<EditState>>,
|
editState: State<GenericLoadable<EditState>>,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
|
val noteEvent = note.event
|
||||||
|
|
||||||
|
val showReply by
|
||||||
|
remember(note) {
|
||||||
|
derivedStateOf {
|
||||||
|
noteEvent is BaseTextNoteEvent && !makeItShort && unPackReply && (note.replyTo != null || noteEvent.hasAnyTaggedUser())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showReply) {
|
||||||
|
val replyingDirectlyTo =
|
||||||
|
remember(note) {
|
||||||
|
if (noteEvent is BaseTextNoteEvent) {
|
||||||
|
val replyingTo = noteEvent.replyingToAddressOrEvent()
|
||||||
|
if (replyingTo != null) {
|
||||||
|
val newNote = accountViewModel.getNoteIfExists(replyingTo)
|
||||||
|
if (newNote != null && newNote.channelHex() == null && newNote.event?.kind() != CommunityDefinitionEvent.KIND) {
|
||||||
|
newNote
|
||||||
|
} else {
|
||||||
|
note.replyTo?.lastOrNull { it.event?.kind() != CommunityDefinitionEvent.KIND }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
note.replyTo?.lastOrNull { it.event?.kind() != CommunityDefinitionEvent.KIND }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
note.replyTo?.lastOrNull { it.event?.kind() != CommunityDefinitionEvent.KIND }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (replyingDirectlyTo != null && unPackReply) {
|
||||||
|
ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav)
|
||||||
|
Spacer(modifier = StdVertSpacer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoadDecryptedContent(
|
LoadDecryptedContent(
|
||||||
note,
|
note,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
|
|
@ -121,14 +121,17 @@ import com.vitorpamplona.amethyst.ui.note.types.EditState
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.FileHeaderDisplay
|
import com.vitorpamplona.amethyst.ui.note.types.FileHeaderDisplay
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.FileStorageHeaderDisplay
|
import com.vitorpamplona.amethyst.ui.note.types.FileStorageHeaderDisplay
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderAppDefinition
|
import com.vitorpamplona.amethyst.ui.note.types.RenderAppDefinition
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.types.RenderChannelMessage
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderEmojiPack
|
import com.vitorpamplona.amethyst.ui.note.types.RenderEmojiPack
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderFhirResource
|
import com.vitorpamplona.amethyst.ui.note.types.RenderFhirResource
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderGitIssueEvent
|
import com.vitorpamplona.amethyst.ui.note.types.RenderGitIssueEvent
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderGitPatchEvent
|
import com.vitorpamplona.amethyst.ui.note.types.RenderGitPatchEvent
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderGitRepositoryEvent
|
import com.vitorpamplona.amethyst.ui.note.types.RenderGitRepositoryEvent
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.types.RenderLiveActivityChatMessage
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderPinListEvent
|
import com.vitorpamplona.amethyst.ui.note.types.RenderPinListEvent
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderPoll
|
import com.vitorpamplona.amethyst.ui.note.types.RenderPoll
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderPostApproval
|
import com.vitorpamplona.amethyst.ui.note.types.RenderPostApproval
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.types.RenderPrivateMessage
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderTextEvent
|
import com.vitorpamplona.amethyst.ui.note.types.RenderTextEvent
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.RenderTextModificationEvent
|
import com.vitorpamplona.amethyst.ui.note.types.RenderTextModificationEvent
|
||||||
import com.vitorpamplona.amethyst.ui.note.types.VideoDisplay
|
import com.vitorpamplona.amethyst.ui.note.types.VideoDisplay
|
||||||
|
@ -152,6 +155,7 @@ import com.vitorpamplona.quartz.events.AudioHeaderEvent
|
||||||
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
||||||
import com.vitorpamplona.quartz.events.BadgeDefinitionEvent
|
import com.vitorpamplona.quartz.events.BadgeDefinitionEvent
|
||||||
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
||||||
|
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
||||||
import com.vitorpamplona.quartz.events.ChannelMetadataEvent
|
import com.vitorpamplona.quartz.events.ChannelMetadataEvent
|
||||||
import com.vitorpamplona.quartz.events.ClassifiedsEvent
|
import com.vitorpamplona.quartz.events.ClassifiedsEvent
|
||||||
import com.vitorpamplona.quartz.events.CommunityDefinitionEvent
|
import com.vitorpamplona.quartz.events.CommunityDefinitionEvent
|
||||||
|
@ -167,10 +171,12 @@ import com.vitorpamplona.quartz.events.GitIssueEvent
|
||||||
import com.vitorpamplona.quartz.events.GitPatchEvent
|
import com.vitorpamplona.quartz.events.GitPatchEvent
|
||||||
import com.vitorpamplona.quartz.events.GitRepositoryEvent
|
import com.vitorpamplona.quartz.events.GitRepositoryEvent
|
||||||
import com.vitorpamplona.quartz.events.HighlightEvent
|
import com.vitorpamplona.quartz.events.HighlightEvent
|
||||||
|
import com.vitorpamplona.quartz.events.LiveActivitiesChatMessageEvent
|
||||||
import com.vitorpamplona.quartz.events.LongTextNoteEvent
|
import com.vitorpamplona.quartz.events.LongTextNoteEvent
|
||||||
import com.vitorpamplona.quartz.events.PeopleListEvent
|
import com.vitorpamplona.quartz.events.PeopleListEvent
|
||||||
import com.vitorpamplona.quartz.events.PinListEvent
|
import com.vitorpamplona.quartz.events.PinListEvent
|
||||||
import com.vitorpamplona.quartz.events.PollNoteEvent
|
import com.vitorpamplona.quartz.events.PollNoteEvent
|
||||||
|
import com.vitorpamplona.quartz.events.PrivateDmEvent
|
||||||
import com.vitorpamplona.quartz.events.RelaySetEvent
|
import com.vitorpamplona.quartz.events.RelaySetEvent
|
||||||
import com.vitorpamplona.quartz.events.RepostEvent
|
import com.vitorpamplona.quartz.events.RepostEvent
|
||||||
import com.vitorpamplona.quartz.events.TextNoteModificationEvent
|
import com.vitorpamplona.quartz.events.TextNoteModificationEvent
|
||||||
|
@ -480,6 +486,11 @@ fun NoteMaster(
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
Column {
|
Column {
|
||||||
|
val canPreview =
|
||||||
|
note.author == account.userProfile() ||
|
||||||
|
(note.author?.let { account.userProfile().isFollowingCached(it) } ?: true) ||
|
||||||
|
!noteForReports.hasAnyReports()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(noteEvent is ChannelCreateEvent || noteEvent is ChannelMetadataEvent) &&
|
(noteEvent is ChannelCreateEvent || noteEvent is ChannelMetadataEvent) &&
|
||||||
note.channelHex() != null
|
note.channelHex() != null
|
||||||
|
@ -570,31 +581,55 @@ fun NoteMaster(
|
||||||
nav,
|
nav,
|
||||||
)
|
)
|
||||||
} else if (noteEvent is PollNoteEvent) {
|
} else if (noteEvent is PollNoteEvent) {
|
||||||
val canPreview =
|
|
||||||
note.author == account.userProfile() ||
|
|
||||||
(note.author?.let { account.userProfile().isFollowingCached(it) } ?: true) ||
|
|
||||||
!noteForReports.hasAnyReports()
|
|
||||||
|
|
||||||
RenderPoll(
|
RenderPoll(
|
||||||
baseNote,
|
baseNote,
|
||||||
false,
|
false,
|
||||||
canPreview,
|
canPreview,
|
||||||
quotesLeft = 3,
|
quotesLeft = 3,
|
||||||
|
unPackReply = false,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
nav,
|
nav,
|
||||||
)
|
)
|
||||||
|
} else if (noteEvent is PrivateDmEvent) {
|
||||||
|
RenderPrivateMessage(
|
||||||
|
baseNote,
|
||||||
|
false,
|
||||||
|
canPreview,
|
||||||
|
3,
|
||||||
|
backgroundColor,
|
||||||
|
accountViewModel,
|
||||||
|
nav,
|
||||||
|
)
|
||||||
|
} else if (noteEvent is ChannelMessageEvent) {
|
||||||
|
RenderChannelMessage(
|
||||||
|
baseNote,
|
||||||
|
false,
|
||||||
|
canPreview,
|
||||||
|
3,
|
||||||
|
backgroundColor,
|
||||||
|
editState,
|
||||||
|
accountViewModel,
|
||||||
|
nav,
|
||||||
|
)
|
||||||
|
} else if (noteEvent is LiveActivitiesChatMessageEvent) {
|
||||||
|
RenderLiveActivityChatMessage(
|
||||||
|
baseNote,
|
||||||
|
false,
|
||||||
|
canPreview,
|
||||||
|
3,
|
||||||
|
backgroundColor,
|
||||||
|
editState,
|
||||||
|
accountViewModel,
|
||||||
|
nav,
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
val canPreview =
|
|
||||||
note.author == account.userProfile() ||
|
|
||||||
(note.author?.let { account.userProfile().isFollowingCached(it) } ?: true) ||
|
|
||||||
!noteForReports.hasAnyReports()
|
|
||||||
|
|
||||||
RenderTextEvent(
|
RenderTextEvent(
|
||||||
baseNote,
|
baseNote,
|
||||||
false,
|
false,
|
||||||
canPreview,
|
canPreview,
|
||||||
quotesLeft = 3,
|
quotesLeft = 3,
|
||||||
|
unPackReply = false,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
editState,
|
editState,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
@ -876,6 +911,7 @@ private fun RenderWikiHeaderForThreadPreview() {
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
quotesLeft = 3,
|
quotesLeft = 3,
|
||||||
|
unPackReply = false,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
editState,
|
editState,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
|
|
@ -94,7 +94,6 @@ import com.vitorpamplona.amethyst.ui.actions.PostButton
|
||||||
import com.vitorpamplona.amethyst.ui.actions.ServerOption
|
import com.vitorpamplona.amethyst.ui.actions.ServerOption
|
||||||
import com.vitorpamplona.amethyst.ui.actions.UploadFromGallery
|
import com.vitorpamplona.amethyst.ui.actions.UploadFromGallery
|
||||||
import com.vitorpamplona.amethyst.ui.actions.UrlUserTagTransformation
|
import com.vitorpamplona.amethyst.ui.actions.UrlUserTagTransformation
|
||||||
import com.vitorpamplona.amethyst.ui.components.ObserveDisplayNip05Status
|
|
||||||
import com.vitorpamplona.amethyst.ui.note.ClickableUserPicture
|
import com.vitorpamplona.amethyst.ui.note.ClickableUserPicture
|
||||||
import com.vitorpamplona.amethyst.ui.note.DisplayRoomSubject
|
import com.vitorpamplona.amethyst.ui.note.DisplayRoomSubject
|
||||||
import com.vitorpamplona.amethyst.ui.note.DisplayUserSetAsSubject
|
import com.vitorpamplona.amethyst.ui.note.DisplayUserSetAsSubject
|
||||||
|
@ -591,7 +590,7 @@ fun ChatroomHeader(
|
||||||
room: ChatroomKey,
|
room: ChatroomKey,
|
||||||
modifier: Modifier = StdPadding,
|
modifier: Modifier = StdPadding,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit,
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
if (room.users.size == 1) {
|
if (room.users.size == 1) {
|
||||||
LoadUser(baseUserHex = room.users.first(), accountViewModel) { baseUser ->
|
LoadUser(baseUserHex = room.users.first(), accountViewModel) { baseUser ->
|
||||||
|
@ -600,7 +599,7 @@ fun ChatroomHeader(
|
||||||
baseUser = baseUser,
|
baseUser = baseUser,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav,
|
onClick = onClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +608,7 @@ fun ChatroomHeader(
|
||||||
room = room,
|
room = room,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav,
|
onClick = onClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,13 +618,13 @@ fun ChatroomHeader(
|
||||||
baseUser: User,
|
baseUser: User,
|
||||||
modifier: Modifier = StdPadding,
|
modifier: Modifier = StdPadding,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit,
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.fillMaxWidth()
|
Modifier.fillMaxWidth()
|
||||||
.clickable(
|
.clickable(
|
||||||
onClick = { nav("User/${baseUser.pubkeyHex}") },
|
onClick = onClick,
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
|
@ -641,7 +640,6 @@ fun ChatroomHeader(
|
||||||
|
|
||||||
Column(modifier = Modifier.padding(start = 10.dp)) {
|
Column(modifier = Modifier.padding(start = 10.dp)) {
|
||||||
UsernameDisplay(baseUser)
|
UsernameDisplay(baseUser)
|
||||||
ObserveDisplayNip05Status(baseUser, accountViewModel = accountViewModel, nav = nav)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,12 +651,10 @@ fun GroupChatroomHeader(
|
||||||
room: ChatroomKey,
|
room: ChatroomKey,
|
||||||
modifier: Modifier = StdPadding,
|
modifier: Modifier = StdPadding,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit,
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val expanded = remember { mutableStateOf(false) }
|
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth().clickable { expanded.value = !expanded.value },
|
modifier = Modifier.fillMaxWidth().clickable(onClick = onClick),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
|
@ -676,10 +672,6 @@ fun GroupChatroomHeader(
|
||||||
DisplayUserSetAsSubject(room, accountViewModel, FontWeight.Normal)
|
DisplayUserSetAsSubject(room, accountViewModel, FontWeight.Normal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expanded.value) {
|
|
||||||
LongRoomHeader(room = room, accountViewModel = accountViewModel, nav = nav)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue