mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-13 02:37:36 +01:00
add draft support for other event kinds
This commit is contained in:
@@ -1311,6 +1311,7 @@ class Account(
|
|||||||
relayList: List<Relay>? = null,
|
relayList: List<Relay>? = null,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<Event>? = null,
|
nip94attachments: List<Event>? = null,
|
||||||
|
draftTag: String?,
|
||||||
) {
|
) {
|
||||||
if (!isWriteable()) return
|
if (!isWriteable()) return
|
||||||
|
|
||||||
@@ -1338,14 +1339,22 @@ class Account(
|
|||||||
geohash = geohash,
|
geohash = geohash,
|
||||||
nip94attachments = nip94attachments,
|
nip94attachments = nip94attachments,
|
||||||
signer = signer,
|
signer = signer,
|
||||||
|
isDraft = draftTag != null,
|
||||||
) {
|
) {
|
||||||
Client.send(it, relayList = relayList)
|
if (draftTag != null) {
|
||||||
LocalCache.justConsume(it, null)
|
DraftEvent.create(draftTag, it, signer) { draftEvent ->
|
||||||
|
Client.send(draftEvent, relayList = relayList)
|
||||||
|
LocalCache.justConsume(draftEvent, null)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Client.send(it, relayList = relayList)
|
||||||
|
LocalCache.justConsume(it, null)
|
||||||
|
|
||||||
replyTo?.forEach { it.event?.let { Client.send(it, relayList = relayList) } }
|
replyTo?.forEach { it.event?.let { Client.send(it, relayList = relayList) } }
|
||||||
addresses?.forEach {
|
addresses?.forEach {
|
||||||
LocalCache.getAddressableNoteIfExists(it.toTag())?.event?.let {
|
LocalCache.getAddressableNoteIfExists(it.toTag())?.event?.let {
|
||||||
Client.send(it, relayList = relayList)
|
Client.send(it, relayList = relayList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1366,6 +1375,7 @@ class Account(
|
|||||||
relayList: List<Relay>? = null,
|
relayList: List<Relay>? = null,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
draftTag: String?,
|
||||||
) {
|
) {
|
||||||
if (!isWriteable()) return
|
if (!isWriteable()) return
|
||||||
|
|
||||||
@@ -1389,20 +1399,28 @@ class Account(
|
|||||||
nip94attachments = nip94attachments,
|
nip94attachments = nip94attachments,
|
||||||
forkedFrom = forkedFrom,
|
forkedFrom = forkedFrom,
|
||||||
signer = signer,
|
signer = signer,
|
||||||
|
isDraft = draftTag != null,
|
||||||
) {
|
) {
|
||||||
Client.send(it, relayList = relayList)
|
if (draftTag != null) {
|
||||||
LocalCache.justConsume(it, null)
|
DraftEvent.create(draftTag, it, signer) { draftEvent ->
|
||||||
|
Client.send(draftEvent, relayList = relayList)
|
||||||
// broadcast replied notes
|
LocalCache.justConsume(draftEvent, null)
|
||||||
replyingTo?.let {
|
|
||||||
LocalCache.getNoteIfExists(replyingTo)?.event?.let {
|
|
||||||
Client.send(it, relayList = relayList)
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
replyTo?.forEach { it.event?.let { Client.send(it, relayList = relayList) } }
|
Client.send(it, relayList = relayList)
|
||||||
addresses?.forEach {
|
LocalCache.justConsume(it, null)
|
||||||
LocalCache.getAddressableNoteIfExists(it.toTag())?.event?.let {
|
|
||||||
Client.send(it, relayList = relayList)
|
// broadcast replied notes
|
||||||
|
replyingTo?.let {
|
||||||
|
LocalCache.getNoteIfExists(replyingTo)?.event?.let {
|
||||||
|
Client.send(it, relayList = relayList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
replyTo?.forEach { it.event?.let { Client.send(it, relayList = relayList) } }
|
||||||
|
addresses?.forEach {
|
||||||
|
LocalCache.getAddressableNoteIfExists(it.toTag())?.event?.let {
|
||||||
|
Client.send(it, relayList = relayList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1512,6 +1530,7 @@ class Account(
|
|||||||
relayList: List<Relay>? = null,
|
relayList: List<Relay>? = null,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
draftTag: String?,
|
||||||
) {
|
) {
|
||||||
if (!isWriteable()) return
|
if (!isWriteable()) return
|
||||||
|
|
||||||
@@ -1535,15 +1554,23 @@ class Account(
|
|||||||
zapRaiserAmount = zapRaiserAmount,
|
zapRaiserAmount = zapRaiserAmount,
|
||||||
geohash = geohash,
|
geohash = geohash,
|
||||||
nip94attachments = nip94attachments,
|
nip94attachments = nip94attachments,
|
||||||
|
isDraft = draftTag != null,
|
||||||
) {
|
) {
|
||||||
Client.send(it, relayList = relayList)
|
if (draftTag != null) {
|
||||||
LocalCache.justConsume(it, null)
|
DraftEvent.create(draftTag, it, signer) { draftEvent ->
|
||||||
|
Client.send(draftEvent, relayList = relayList)
|
||||||
|
LocalCache.justConsume(draftEvent, null)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Client.send(it, relayList = relayList)
|
||||||
|
LocalCache.justConsume(it, null)
|
||||||
|
|
||||||
// Rebroadcast replies and tags to the current relay set
|
// Rebroadcast replies and tags to the current relay set
|
||||||
replyTo?.forEach { it.event?.let { Client.send(it, relayList = relayList) } }
|
replyTo?.forEach { it.event?.let { Client.send(it, relayList = relayList) } }
|
||||||
addresses?.forEach {
|
addresses?.forEach {
|
||||||
LocalCache.getAddressableNoteIfExists(it.toTag())?.event?.let {
|
LocalCache.getAddressableNoteIfExists(it.toTag())?.event?.let {
|
||||||
Client.send(it, relayList = relayList)
|
Client.send(it, relayList = relayList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1559,6 +1586,7 @@ class Account(
|
|||||||
zapRaiserAmount: Long? = null,
|
zapRaiserAmount: Long? = null,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
draftTag: String?,
|
||||||
) {
|
) {
|
||||||
if (!isWriteable()) return
|
if (!isWriteable()) return
|
||||||
|
|
||||||
@@ -1576,9 +1604,17 @@ class Account(
|
|||||||
geohash = geohash,
|
geohash = geohash,
|
||||||
nip94attachments = nip94attachments,
|
nip94attachments = nip94attachments,
|
||||||
signer = signer,
|
signer = signer,
|
||||||
|
isDraft = draftTag != null,
|
||||||
) {
|
) {
|
||||||
Client.send(it)
|
if (draftTag != null) {
|
||||||
LocalCache.justConsume(it, null)
|
DraftEvent.create(draftTag, it, signer) { draftEvent ->
|
||||||
|
Client.send(draftEvent)
|
||||||
|
LocalCache.justConsume(draftEvent, null)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Client.send(it)
|
||||||
|
LocalCache.justConsume(it, null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1592,6 +1628,7 @@ class Account(
|
|||||||
zapRaiserAmount: Long? = null,
|
zapRaiserAmount: Long? = null,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
draftTag: String?,
|
||||||
) {
|
) {
|
||||||
if (!isWriteable()) return
|
if (!isWriteable()) return
|
||||||
|
|
||||||
@@ -1610,9 +1647,17 @@ class Account(
|
|||||||
geohash = geohash,
|
geohash = geohash,
|
||||||
nip94attachments = nip94attachments,
|
nip94attachments = nip94attachments,
|
||||||
signer = signer,
|
signer = signer,
|
||||||
|
isDraft = draftTag != null,
|
||||||
) {
|
) {
|
||||||
Client.send(it)
|
if (draftTag != null) {
|
||||||
LocalCache.justConsume(it, null)
|
DraftEvent.create(draftTag, it, signer) { draftEvent ->
|
||||||
|
Client.send(draftEvent)
|
||||||
|
LocalCache.justConsume(draftEvent, null)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Client.send(it)
|
||||||
|
LocalCache.justConsume(it, null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1626,6 +1671,7 @@ class Account(
|
|||||||
zapRaiserAmount: Long? = null,
|
zapRaiserAmount: Long? = null,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
draftTag: String?,
|
||||||
) {
|
) {
|
||||||
sendPrivateMessage(
|
sendPrivateMessage(
|
||||||
message,
|
message,
|
||||||
@@ -1637,6 +1683,7 @@ class Account(
|
|||||||
zapRaiserAmount,
|
zapRaiserAmount,
|
||||||
geohash,
|
geohash,
|
||||||
nip94attachments,
|
nip94attachments,
|
||||||
|
draftTag,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1650,6 +1697,7 @@ class Account(
|
|||||||
zapRaiserAmount: Long? = null,
|
zapRaiserAmount: Long? = null,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
draftTag: String?,
|
||||||
) {
|
) {
|
||||||
if (!isWriteable()) return
|
if (!isWriteable()) return
|
||||||
|
|
||||||
@@ -1669,9 +1717,17 @@ class Account(
|
|||||||
nip94attachments = nip94attachments,
|
nip94attachments = nip94attachments,
|
||||||
signer = signer,
|
signer = signer,
|
||||||
advertiseNip18 = false,
|
advertiseNip18 = false,
|
||||||
|
isDraft = draftTag != null,
|
||||||
) {
|
) {
|
||||||
Client.send(it)
|
if (draftTag != null) {
|
||||||
LocalCache.consume(it, null)
|
DraftEvent.create(draftTag, it, signer) { draftEvent ->
|
||||||
|
Client.send(draftEvent)
|
||||||
|
LocalCache.justConsume(draftEvent, null)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Client.send(it)
|
||||||
|
LocalCache.consume(it, null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ open class Note(val idHex: String) {
|
|||||||
var event: EventInterface? = null
|
var event: EventInterface? = null
|
||||||
var author: User? = null
|
var author: User? = null
|
||||||
var replyTo: List<Note>? = null
|
var replyTo: List<Note>? = null
|
||||||
var draft: String? = null
|
|
||||||
|
|
||||||
// These fields are updated every time an event related to this note is received.
|
// These fields are updated every time an event related to this note is received.
|
||||||
var replies = listOf<Note>()
|
var replies = listOf<Note>()
|
||||||
@@ -184,13 +183,9 @@ open class Note(val idHex: String) {
|
|||||||
|
|
||||||
open fun createdAt() = event?.createdAt()
|
open fun createdAt() = event?.createdAt()
|
||||||
|
|
||||||
fun updateDraft(id: String) {
|
|
||||||
draft = id
|
|
||||||
}
|
|
||||||
|
|
||||||
fun isDraft(): Boolean {
|
fun isDraft(): Boolean {
|
||||||
draft?.let {
|
event?.let {
|
||||||
return it.isNotBlank()
|
return it.sig().isBlank()
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,8 +281,6 @@ object NostrAccountDataSource : NostrDataSource("AccountData") {
|
|||||||
|
|
||||||
event.plainContent(account.signer) {
|
event.plainContent(account.signer) {
|
||||||
LocalCache.justConsume(it, relay)
|
LocalCache.justConsume(it, relay)
|
||||||
val draftNote = LocalCache.getNoteIfExists(it.id)
|
|
||||||
draftNote?.updateDraft(event.id)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
zapRaiserAmount = localZapRaiserAmount,
|
zapRaiserAmount = localZapRaiserAmount,
|
||||||
geohash = geoHash,
|
geohash = geoHash,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = localDraft,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
account?.sendChannelMessage(
|
account?.sendChannelMessage(
|
||||||
@@ -383,6 +384,7 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
zapRaiserAmount = localZapRaiserAmount,
|
zapRaiserAmount = localZapRaiserAmount,
|
||||||
geohash = geoHash,
|
geohash = geoHash,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = localDraft,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else if (originalNote?.event is PrivateDmEvent) {
|
} else if (originalNote?.event is PrivateDmEvent) {
|
||||||
@@ -396,6 +398,7 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
zapRaiserAmount = localZapRaiserAmount,
|
zapRaiserAmount = localZapRaiserAmount,
|
||||||
geohash = geoHash,
|
geohash = geoHash,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = localDraft,
|
||||||
)
|
)
|
||||||
} else if (originalNote?.event is ChatMessageEvent) {
|
} else if (originalNote?.event is ChatMessageEvent) {
|
||||||
val receivers =
|
val receivers =
|
||||||
@@ -443,6 +446,7 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
zapRaiserAmount = localZapRaiserAmount,
|
zapRaiserAmount = localZapRaiserAmount,
|
||||||
geohash = geoHash,
|
geohash = geoHash,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = localDraft,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else if (originalNote?.event is GitIssueEvent) {
|
} else if (originalNote?.event is GitIssueEvent) {
|
||||||
@@ -483,6 +487,7 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
relayList = relayList,
|
relayList = relayList,
|
||||||
geohash = geoHash,
|
geohash = geoHash,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = localDraft,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
if (wantsPoll) {
|
if (wantsPoll) {
|
||||||
@@ -501,6 +506,7 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
relayList,
|
relayList,
|
||||||
geoHash,
|
geoHash,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = localDraft,
|
||||||
)
|
)
|
||||||
} else if (wantsProduct) {
|
} else if (wantsProduct) {
|
||||||
account?.sendClassifieds(
|
account?.sendClassifieds(
|
||||||
@@ -519,6 +525,7 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
relayList = relayList,
|
relayList = relayList,
|
||||||
geohash = geoHash,
|
geohash = geoHash,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = localDraft,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// adds markers
|
// adds markers
|
||||||
@@ -555,7 +562,7 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
relayList = relayList,
|
relayList = relayList,
|
||||||
geohash = geoHash,
|
geohash = geoHash,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
draftTag = draftTag,
|
draftTag = localDraft,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1171,7 +1171,6 @@ fun FirstUserInfoRow(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (baseNote.isDraft()) {
|
if (baseNote.isDraft()) {
|
||||||
Spacer(StdHorzSpacer)
|
|
||||||
DisplayDraft()
|
DisplayDraft()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ fun ChannelScreen(
|
|||||||
mentions = tagger.pTags,
|
mentions = tagger.pTags,
|
||||||
wantsToMarkAsSensitive = false,
|
wantsToMarkAsSensitive = false,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = null,
|
||||||
)
|
)
|
||||||
} else if (channel is LiveActivitiesChannel) {
|
} else if (channel is LiveActivitiesChannel) {
|
||||||
accountViewModel.account.sendLiveMessage(
|
accountViewModel.account.sendLiveMessage(
|
||||||
@@ -334,6 +335,7 @@ fun ChannelScreen(
|
|||||||
mentions = tagger.pTags,
|
mentions = tagger.pTags,
|
||||||
wantsToMarkAsSensitive = false,
|
wantsToMarkAsSensitive = false,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
newPostModel.message = TextFieldValue("")
|
newPostModel.message = TextFieldValue("")
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ fun ChatroomScreen(
|
|||||||
mentions = null,
|
mentions = null,
|
||||||
wantsToMarkAsSensitive = false,
|
wantsToMarkAsSensitive = false,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class ChannelMessageEvent(
|
|||||||
zapRaiserAmount: Long?,
|
zapRaiserAmount: Long?,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
isDraft: Boolean,
|
||||||
onReady: (ChannelMessageEvent) -> Unit,
|
onReady: (ChannelMessageEvent) -> Unit,
|
||||||
) {
|
) {
|
||||||
val tags =
|
val tags =
|
||||||
@@ -87,7 +88,7 @@ class ChannelMessageEvent(
|
|||||||
arrayOf("alt", ALT),
|
arrayOf("alt", ALT),
|
||||||
)
|
)
|
||||||
|
|
||||||
signer.sign(createdAt, KIND, tags.toTypedArray(), message, onReady)
|
signer.sign(createdAt, KIND, tags.toTypedArray(), message, onReady, isDraft)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ class ClassifiedsEvent(
|
|||||||
nip94attachments: List<Event>? = null,
|
nip94attachments: List<Event>? = null,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
createdAt: Long = TimeUtils.now(),
|
createdAt: Long = TimeUtils.now(),
|
||||||
|
isDraft: Boolean,
|
||||||
onReady: (ClassifiedsEvent) -> Unit,
|
onReady: (ClassifiedsEvent) -> Unit,
|
||||||
) {
|
) {
|
||||||
val tags = mutableListOf<Array<String>>()
|
val tags = mutableListOf<Array<String>>()
|
||||||
@@ -172,7 +173,7 @@ class ClassifiedsEvent(
|
|||||||
}
|
}
|
||||||
tags.add(arrayOf("alt", ALT))
|
tags.add(arrayOf("alt", ALT))
|
||||||
|
|
||||||
signer.sign(createdAt, KIND, tags.toTypedArray(), message, onReady)
|
signer.sign(createdAt, KIND, tags.toTypedArray(), message, onReady, isDraft)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ class GitReplyEvent(
|
|||||||
forkedFrom: Event? = null,
|
forkedFrom: Event? = null,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
createdAt: Long = TimeUtils.now(),
|
createdAt: Long = TimeUtils.now(),
|
||||||
|
isDraft: Boolean,
|
||||||
onReady: (GitReplyEvent) -> Unit,
|
onReady: (GitReplyEvent) -> Unit,
|
||||||
) {
|
) {
|
||||||
val tags = mutableListOf<Array<String>>()
|
val tags = mutableListOf<Array<String>>()
|
||||||
@@ -156,7 +157,7 @@ class GitReplyEvent(
|
|||||||
}
|
}
|
||||||
tags.add(arrayOf("alt", "a git issue reply"))
|
tags.add(arrayOf("alt", "a git issue reply"))
|
||||||
|
|
||||||
signer.sign(createdAt, KIND, tags.toTypedArray(), msg, onReady)
|
signer.sign(createdAt, KIND, tags.toTypedArray(), msg, onReady, isDraft)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class LiveActivitiesChatMessageEvent(
|
|||||||
zapRaiserAmount: Long?,
|
zapRaiserAmount: Long?,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
isDraft: Boolean,
|
||||||
onReady: (LiveActivitiesChatMessageEvent) -> Unit,
|
onReady: (LiveActivitiesChatMessageEvent) -> Unit,
|
||||||
) {
|
) {
|
||||||
val content = message
|
val content = message
|
||||||
@@ -98,7 +99,7 @@ class LiveActivitiesChatMessageEvent(
|
|||||||
}
|
}
|
||||||
tags.add(arrayOf("alt", ALT))
|
tags.add(arrayOf("alt", ALT))
|
||||||
|
|
||||||
signer.sign(createdAt, KIND, tags.toTypedArray(), content, onReady)
|
signer.sign(createdAt, KIND, tags.toTypedArray(), content, onReady, isDraft)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class PollNoteEvent(
|
|||||||
zapRaiserAmount: Long?,
|
zapRaiserAmount: Long?,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
isDraft: Boolean,
|
||||||
onReady: (PollNoteEvent) -> Unit,
|
onReady: (PollNoteEvent) -> Unit,
|
||||||
) {
|
) {
|
||||||
val tags = mutableListOf<Array<String>>()
|
val tags = mutableListOf<Array<String>>()
|
||||||
@@ -112,7 +113,7 @@ class PollNoteEvent(
|
|||||||
}
|
}
|
||||||
tags.add(arrayOf("alt", ALT))
|
tags.add(arrayOf("alt", ALT))
|
||||||
|
|
||||||
signer.sign(createdAt, KIND, tags.toTypedArray(), msg, onReady)
|
signer.sign(createdAt, KIND, tags.toTypedArray(), msg, onReady, isDraft)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ class PrivateDmEvent(
|
|||||||
zapRaiserAmount: Long?,
|
zapRaiserAmount: Long?,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
nip94attachments: List<FileHeaderEvent>? = null,
|
nip94attachments: List<FileHeaderEvent>? = null,
|
||||||
|
isDraft: Boolean,
|
||||||
onReady: (PrivateDmEvent) -> Unit,
|
onReady: (PrivateDmEvent) -> Unit,
|
||||||
) {
|
) {
|
||||||
var message = msg
|
var message = msg
|
||||||
@@ -165,7 +166,7 @@ class PrivateDmEvent(
|
|||||||
tags.add(arrayOf("alt", ALT))
|
tags.add(arrayOf("alt", ALT))
|
||||||
|
|
||||||
signer.nip04Encrypt(message, recipientPubKey) { content ->
|
signer.nip04Encrypt(message, recipientPubKey) { content ->
|
||||||
signer.sign(createdAt, KIND, tags.toTypedArray(), content, onReady)
|
signer.sign(createdAt, KIND, tags.toTypedArray(), content, onReady, isDraft)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user