Fixes notification autoupdating

pull/37/head
Vitor Pamplona 2023-01-25 13:29:44 -03:00
rodzic 4c15420b05
commit 542bd485d0
6 zmienionych plików z 11 dodań i 8 usunięć

Wyświetl plik

@ -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 ->

Wyświetl plik

@ -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
)

Wyświetl plik

@ -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)

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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)

Wyświetl plik

@ -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)