mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-26 17:52:29 +01:00
Fixes notification autoupdating
This commit is contained in:
parent
4c15420b05
commit
542bd485d0
@ -40,7 +40,7 @@ fun isValidURL(url: String?): Boolean {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun RichTextViewer(content: String, tags: List<List<String>>?, note: Note, accountViewModel: AccountViewModel, navController: NavController) {
|
||||
fun RichTextViewer(content: String, tags: List<List<String>>?, navController: NavController) {
|
||||
Column(modifier = Modifier.padding(top = 5.dp)) {
|
||||
// FlowRow doesn't work well with paragraphs. So we need to split them
|
||||
content.split('\n').forEach { paragraph ->
|
||||
|
@ -177,16 +177,12 @@ fun ChatroomMessageCompose(baseNote: Note, innerQuote: Boolean = false, accountV
|
||||
RichTextViewer(
|
||||
eventContent,
|
||||
note.event?.tags,
|
||||
note,
|
||||
accountViewModel,
|
||||
navController
|
||||
)
|
||||
else
|
||||
RichTextViewer(
|
||||
"Could Not decrypt the message",
|
||||
note.event?.tags,
|
||||
note,
|
||||
accountViewModel,
|
||||
navController
|
||||
)
|
||||
|
||||
|
@ -183,7 +183,7 @@ fun NoteCompose(baseNote: Note, modifier: Modifier = Modifier, isInnerNote: Bool
|
||||
} else {
|
||||
val eventContent = note.event?.content
|
||||
if (eventContent != null)
|
||||
RichTextViewer(eventContent, note.event?.tags, note, accountViewModel, navController)
|
||||
RichTextViewer(eventContent, note.event?.tags, navController)
|
||||
|
||||
if (note.event !is ChannelMessageEvent) {
|
||||
ReactionsRowState(note, accountViewModel)
|
||||
|
@ -4,12 +4,15 @@ import com.vitorpamplona.amethyst.model.Note
|
||||
|
||||
abstract class Card() {
|
||||
abstract fun createdAt(): Long
|
||||
abstract fun id(): String
|
||||
}
|
||||
|
||||
class NoteCard(val note: Note): Card() {
|
||||
override fun createdAt(): Long {
|
||||
return note.event?.createdAt ?: 0
|
||||
}
|
||||
|
||||
override fun id() = note.idHex
|
||||
}
|
||||
|
||||
class LikeSetCard(val note: Note, val likeEvents: List<Note>): Card() {
|
||||
@ -18,6 +21,8 @@ class LikeSetCard(val note: Note, val likeEvents: List<Note>): Card() {
|
||||
override fun createdAt(): Long {
|
||||
return createdAt
|
||||
}
|
||||
|
||||
override fun id() = note.idHex + createdAt
|
||||
}
|
||||
|
||||
class BoostSetCard(val note: Note, val boostEvents: List<Note>): Card() {
|
||||
@ -26,6 +31,8 @@ class BoostSetCard(val note: Note, val boostEvents: List<Note>): Card() {
|
||||
override fun createdAt(): Long {
|
||||
return createdAt
|
||||
}
|
||||
|
||||
override fun id() = note.idHex + createdAt
|
||||
}
|
||||
|
||||
sealed class CardFeedState {
|
||||
|
@ -66,7 +66,7 @@ fun CardFeedView(viewModel: CardFeedViewModel, accountViewModel: AccountViewMode
|
||||
),
|
||||
state = listState
|
||||
) {
|
||||
itemsIndexed(state.feed) { index, item ->
|
||||
itemsIndexed(state.feed, key = { _, item -> item.id() }) { index, item ->
|
||||
when (item) {
|
||||
is NoteCard -> NoteCompose(item.note, isInnerNote = false, accountViewModel = accountViewModel, navController = navController)
|
||||
is LikeSetCard -> LikeSetCompose(item, isInnerNote = false, accountViewModel = accountViewModel, navController = navController)
|
||||
|
@ -203,7 +203,7 @@ fun NoteMaster(baseNote: Note, accountViewModel: AccountViewModel, navController
|
||||
Column() {
|
||||
val eventContent = note.event?.content
|
||||
if (eventContent != null)
|
||||
RichTextViewer(eventContent, note.event?.tags, note, accountViewModel, navController)
|
||||
RichTextViewer(eventContent, note.event?.tags, navController)
|
||||
|
||||
ReactionsRowState(note, accountViewModel)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user