- Migrates NIP-17 DM new message model to its own model and disable some of the generic behavior from new posts.
- Fixes a bug on edits showing a previous edit. - Refactors user suggestions and lastword procedures - Adds a DM inline reply from other parts of the app, like on notification. - Hides Retweet button from DMs on Notifications - Fixes colors for drafts in chats. - Adds a nav function that computes the destination only after the user clicks on it and on a coroutine.
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ data class Address(
|
||||
fun parse(addressId: String): Address? =
|
||||
try {
|
||||
val parts = addressId.split(":", limit = 3)
|
||||
if (parts[1].length == 64 && Hex.isHex(parts[1])) {
|
||||
if (parts.size > 1 && parts[1].length == 64 && Hex.isHex(parts[1])) {
|
||||
Address(parts[0].toInt(), parts[1], parts[2])
|
||||
} else {
|
||||
Log.w("AddressableId", "Error parsing. Pubkey is not hex: $addressId")
|
||||
|
||||
@@ -60,11 +60,12 @@ class ChatMessageEvent(
|
||||
|
||||
fun reply(
|
||||
msg: String,
|
||||
reply: EventHintBundle<ChatMessageEvent>,
|
||||
reply: EventHintBundle<BaseDMGroupEvent>,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<ChatMessageEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, msg, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
reply(reply)
|
||||
group((reply.event.recipients() + reply.toPTag()).distinctBy { it.pubKey })
|
||||
initializer()
|
||||
}
|
||||
|
||||
+2
-1
@@ -27,10 +27,11 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTags
|
||||
import com.vitorpamplona.quartz.nip10Notes.tags.MarkedETag
|
||||
import com.vitorpamplona.quartz.nip14Subject.SubjectTag
|
||||
import com.vitorpamplona.quartz.nip17Dm.base.BaseDMGroupEvent
|
||||
|
||||
fun TagArrayBuilder<ChatMessageEvent>.reply(msg: MarkedETag) = add(msg.toTagArray())
|
||||
|
||||
fun TagArrayBuilder<ChatMessageEvent>.reply(msg: EventHintBundle<ChatMessageEvent>) = reply(msg.toMarkedETag(MarkedETag.MARKER.REPLY))
|
||||
fun TagArrayBuilder<ChatMessageEvent>.reply(msg: EventHintBundle<BaseDMGroupEvent>) = reply(msg.toMarkedETag(MarkedETag.MARKER.REPLY))
|
||||
|
||||
fun TagArrayBuilder<ChatMessageEvent>.group(list: List<PTag>) = pTags(list)
|
||||
|
||||
|
||||
@@ -29,13 +29,15 @@ data class EmojiUrlTag(
|
||||
) {
|
||||
fun encode(): String = ":$code:$url"
|
||||
|
||||
fun toContentEncode(): String = ":$code"
|
||||
fun toContentEncode(): String = contentEncode(code)
|
||||
|
||||
fun toTagArray() = arrayOf("emoji", code, url)
|
||||
|
||||
companion object {
|
||||
const val TAG_NAME = "emoji"
|
||||
|
||||
fun contentEncode(code: String): String = ":$code:"
|
||||
|
||||
fun decode(encodedEmojiSetup: String): EmojiUrlTag? {
|
||||
val emojiParts = encodedEmojiSetup.split(":", limit = 3)
|
||||
return if (emojiParts.size > 2) {
|
||||
|
||||
@@ -35,3 +35,8 @@ class IMetaTagBuilder(
|
||||
|
||||
fun build() = IMetaTag(url, properties)
|
||||
}
|
||||
|
||||
fun imetaTagBuilder(
|
||||
url: String,
|
||||
init: IMetaTagBuilder.() -> Unit,
|
||||
) = IMetaTagBuilder(url).apply(init).build()
|
||||
|
||||
Reference in New Issue
Block a user