Support for NIP-14
This commit is contained in:
@@ -19,6 +19,8 @@ class TextNoteEvent(
|
|||||||
sig: HexKey
|
sig: HexKey
|
||||||
) : BaseTextNoteEvent(id, pubKey, createdAt, kind, tags, content, sig) {
|
) : BaseTextNoteEvent(id, pubKey, createdAt, kind, tags, content, sig) {
|
||||||
|
|
||||||
|
fun subject() = tags.firstOrNull() { it.size > 1 && it[0] == "subject" }?.get(1)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val kind = 1
|
const val kind = 1
|
||||||
|
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ fun routeFor(note: Note, loggedIn: User): String? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun RenderTextEvent(
|
fun RenderTextEvent(
|
||||||
note: Note,
|
note: Note,
|
||||||
makeItShort: Boolean,
|
makeItShort: Boolean,
|
||||||
canPreview: Boolean,
|
canPreview: Boolean,
|
||||||
@@ -747,7 +747,16 @@ private fun RenderTextEvent(
|
|||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
val eventContent = remember(note.event) { accountViewModel.decrypt(note) }
|
val eventContent = remember(note.event) {
|
||||||
|
val subject = (note.event as? TextNoteEvent)?.subject()?.ifEmpty { null }
|
||||||
|
val body = accountViewModel.decrypt(note)
|
||||||
|
|
||||||
|
if (subject != null) {
|
||||||
|
"## $subject\n$body"
|
||||||
|
} else {
|
||||||
|
body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (eventContent != null) {
|
if (eventContent != null) {
|
||||||
val isAuthorTheLoggedUser = remember(note.event) { accountViewModel.isLoggedUser(note.author) }
|
val isAuthorTheLoggedUser = remember(note.event) { accountViewModel.isLoggedUser(note.author) }
|
||||||
@@ -787,7 +796,7 @@ private fun RenderTextEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun RenderPoll(
|
fun RenderPoll(
|
||||||
note: Note,
|
note: Note,
|
||||||
makeItShort: Boolean,
|
makeItShort: Boolean,
|
||||||
canPreview: Boolean,
|
canPreview: Boolean,
|
||||||
|
|||||||
Reference in New Issue
Block a user