Clean up on unnecessary methods on Note
This commit is contained in:
+1
-1
@@ -495,7 +495,7 @@ class ChatNewMessageViewModel :
|
||||
toUser = toUser,
|
||||
message = message,
|
||||
imetas = usedAttachments,
|
||||
replyingTo = replyTo.value?.toEId(),
|
||||
replyingTo = replyTo.value?.toEventHint<PrivateDmEvent>(),
|
||||
signer = accountViewModel.account.signer,
|
||||
) {
|
||||
expiration?.let { expiration(it) }
|
||||
|
||||
@@ -35,13 +35,9 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.EventReference
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.anyHashTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.publishedAt.PublishedAtProvider
|
||||
import com.vitorpamplona.quartz.nip10Notes.BaseThreadedEvent
|
||||
import com.vitorpamplona.quartz.nip10Notes.tags.MarkedETag
|
||||
import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent
|
||||
import com.vitorpamplona.quartz.nip18Reposts.RepostEvent
|
||||
import com.vitorpamplona.quartz.nip19Bech32.entities.NAddress
|
||||
@@ -102,8 +98,6 @@ class AddressableNote(
|
||||
fun dTag(): String = address.dTag
|
||||
|
||||
fun toNAddr() = NAddress.create(address.kind, address.pubKeyHex, address.dTag, relayHintUrl())
|
||||
|
||||
fun toATag() = ATag(address, relayHintUrl())
|
||||
}
|
||||
|
||||
@Stable
|
||||
@@ -915,25 +909,6 @@ open class Note(
|
||||
}
|
||||
}
|
||||
|
||||
fun toETag(): ETag {
|
||||
val noteEvent = event
|
||||
return if (noteEvent != null) {
|
||||
ETag(noteEvent.id, relayHintUrl(), noteEvent.pubKey)
|
||||
} else {
|
||||
ETag(idHex, relayHintUrl(), author?.pubkeyHex)
|
||||
}
|
||||
}
|
||||
|
||||
fun toEId(): EventReference {
|
||||
val noteEvent = event
|
||||
return if (noteEvent != null) {
|
||||
// uses the confirmed event id if available
|
||||
EventReference(noteEvent.id, noteEvent.pubKey, relayHintUrl())
|
||||
} else {
|
||||
EventReference(idHex, author?.pubkeyHex, relayHintUrl())
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T : Event> toEventHint(): EventHintBundle<T>? {
|
||||
val safeEvent = event
|
||||
return if (safeEvent is T) {
|
||||
@@ -942,15 +917,6 @@ open class Note(
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun toMarkedETag(marker: MarkedETag.MARKER): MarkedETag {
|
||||
val noteEvent = event
|
||||
return if (noteEvent != null) {
|
||||
MarkedETag(noteEvent.id, relayHintUrl(), marker, noteEvent.pubKey)
|
||||
} else {
|
||||
MarkedETag(idHex, relayHintUrl(), marker, author?.pubkeyHex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Stable
|
||||
|
||||
+3
-3
@@ -26,11 +26,11 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.core.any
|
||||
import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle
|
||||
import com.vitorpamplona.quartz.nip01Core.hints.PubKeyHintProvider
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.SignerExceptions
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.EventReference
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip10Notes.tags.MarkedETag
|
||||
@@ -126,7 +126,7 @@ class PrivateDmEvent(
|
||||
toUser: PTag,
|
||||
message: String,
|
||||
imetas: List<IMetaTag>? = null,
|
||||
replyingTo: EventReference? = null,
|
||||
replyingTo: EventHintBundle<PrivateDmEvent>? = null,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
signer: NostrSigner,
|
||||
initializer: TagArrayBuilder<PrivateDmEvent>.() -> Unit = {},
|
||||
@@ -150,7 +150,7 @@ class PrivateDmEvent(
|
||||
to: PTag,
|
||||
message: String,
|
||||
imetas: List<IMetaTag>? = null,
|
||||
replyingTo: EventReference?,
|
||||
replyingTo: EventHintBundle<PrivateDmEvent>?,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
signer: NostrSigner,
|
||||
) = signer.sign(build(to, message, imetas, replyingTo, createdAt, signer))
|
||||
|
||||
Reference in New Issue
Block a user