add edit draft in the dropdown menu and the long press popup
This commit is contained in:
@@ -1369,7 +1369,7 @@ class Account(
|
|||||||
Client.send(draftEvent, relayList = relayList)
|
Client.send(draftEvent, relayList = relayList)
|
||||||
LocalCache.justConsume(draftEvent, null)
|
LocalCache.justConsume(draftEvent, null)
|
||||||
LocalCache.justConsume(it, null)
|
LocalCache.justConsume(it, null)
|
||||||
LocalCache.addDraft(draftTag, it.id())
|
LocalCache.addDraft(draftTag, draftEvent.id(), it.id())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Client.send(it, relayList = relayList)
|
Client.send(it, relayList = relayList)
|
||||||
@@ -1431,7 +1431,7 @@ class Account(
|
|||||||
Client.send(draftEvent, relayList = relayList)
|
Client.send(draftEvent, relayList = relayList)
|
||||||
LocalCache.justConsume(draftEvent, null)
|
LocalCache.justConsume(draftEvent, null)
|
||||||
LocalCache.justConsume(it, null)
|
LocalCache.justConsume(it, null)
|
||||||
LocalCache.addDraft(draftTag, it.id())
|
LocalCache.addDraft(draftTag, draftEvent.id(), it.id())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Client.send(it, relayList = relayList)
|
Client.send(it, relayList = relayList)
|
||||||
@@ -1499,7 +1499,7 @@ class Account(
|
|||||||
Client.send(draftEvent, relayList = relayList)
|
Client.send(draftEvent, relayList = relayList)
|
||||||
LocalCache.justConsume(draftEvent, null)
|
LocalCache.justConsume(draftEvent, null)
|
||||||
LocalCache.justConsume(it, null)
|
LocalCache.justConsume(it, null)
|
||||||
LocalCache.addDraft(draftTag, it.id())
|
LocalCache.addDraft(draftTag, draftEvent.id(), it.id())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Client.send(it, relayList = relayList)
|
Client.send(it, relayList = relayList)
|
||||||
@@ -1590,7 +1590,7 @@ class Account(
|
|||||||
Client.send(draftEvent, relayList = relayList)
|
Client.send(draftEvent, relayList = relayList)
|
||||||
LocalCache.justConsume(draftEvent, null)
|
LocalCache.justConsume(draftEvent, null)
|
||||||
LocalCache.justConsume(it, null)
|
LocalCache.justConsume(it, null)
|
||||||
LocalCache.addDraft(draftTag, it.id())
|
LocalCache.addDraft(draftTag, draftEvent.id(), it.id())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Client.send(it, relayList = relayList)
|
Client.send(it, relayList = relayList)
|
||||||
@@ -1642,7 +1642,7 @@ class Account(
|
|||||||
Client.send(draftEvent)
|
Client.send(draftEvent)
|
||||||
LocalCache.justConsume(draftEvent, null)
|
LocalCache.justConsume(draftEvent, null)
|
||||||
LocalCache.justConsume(it, null)
|
LocalCache.justConsume(it, null)
|
||||||
LocalCache.addDraft(draftTag, it.id())
|
LocalCache.addDraft(draftTag, draftEvent.id(), it.id())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Client.send(it)
|
Client.send(it)
|
||||||
@@ -1687,7 +1687,7 @@ class Account(
|
|||||||
Client.send(draftEvent)
|
Client.send(draftEvent)
|
||||||
LocalCache.justConsume(draftEvent, null)
|
LocalCache.justConsume(draftEvent, null)
|
||||||
LocalCache.justConsume(it, null)
|
LocalCache.justConsume(it, null)
|
||||||
LocalCache.addDraft(draftTag, it.id())
|
LocalCache.addDraft(draftTag, draftEvent.id(), it.id())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Client.send(it)
|
Client.send(it)
|
||||||
@@ -1759,7 +1759,7 @@ class Account(
|
|||||||
Client.send(draftEvent)
|
Client.send(draftEvent)
|
||||||
LocalCache.justConsume(draftEvent, null)
|
LocalCache.justConsume(draftEvent, null)
|
||||||
LocalCache.justConsume(it, null)
|
LocalCache.justConsume(it, null)
|
||||||
LocalCache.addDraft(draftTag, it.id())
|
LocalCache.addDraft(draftTag, draftEvent.id(), it.id())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Client.send(it)
|
Client.send(it)
|
||||||
@@ -1805,7 +1805,7 @@ class Account(
|
|||||||
Client.send(draftEvent)
|
Client.send(draftEvent)
|
||||||
LocalCache.justConsume(draftEvent, null)
|
LocalCache.justConsume(draftEvent, null)
|
||||||
LocalCache.justConsume(it.msg, null)
|
LocalCache.justConsume(it.msg, null)
|
||||||
LocalCache.addDraft(draftTag, it.msg.id())
|
LocalCache.addDraft(draftTag, draftEvent.id(), it.msg.id())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
broadcastPrivately(it)
|
broadcastPrivately(it)
|
||||||
|
|||||||
@@ -1,2 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2024 Vitor Pamplona
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to use,
|
||||||
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||||
|
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||||
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
package com.vitorpamplona.amethyst.model
|
package com.vitorpamplona.amethyst.model
|
||||||
|
|
||||||
|
data class Drafts(val mainId: String, val eventId: String)
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ object LocalCache {
|
|||||||
val users = LargeCache<HexKey, User>()
|
val users = LargeCache<HexKey, User>()
|
||||||
val notes = LargeCache<HexKey, Note>()
|
val notes = LargeCache<HexKey, Note>()
|
||||||
val addressables = LargeCache<String, AddressableNote>()
|
val addressables = LargeCache<String, AddressableNote>()
|
||||||
val drafts = ConcurrentHashMap<String, MutableList<HexKey>>()
|
val drafts = ConcurrentHashMap<String, MutableList<Drafts>>()
|
||||||
val channels = ConcurrentHashMap<HexKey, Channel>()
|
val channels = ConcurrentHashMap<HexKey, Channel>()
|
||||||
val awaitingPaymentRequests = ConcurrentHashMap<HexKey, Pair<Note?, (LnZapPaymentResponseEvent) -> Unit>>(10)
|
val awaitingPaymentRequests = ConcurrentHashMap<HexKey, Pair<Note?, (LnZapPaymentResponseEvent) -> Unit>>(10)
|
||||||
|
|
||||||
@@ -144,26 +144,31 @@ object LocalCache {
|
|||||||
|
|
||||||
fun draftNotes(draftTag: String): List<Note> {
|
fun draftNotes(draftTag: String): List<Note> {
|
||||||
return drafts[draftTag]?.mapNotNull {
|
return drafts[draftTag]?.mapNotNull {
|
||||||
checkGetOrCreateNote(it)
|
getNoteIfExists(it.mainId)
|
||||||
} ?: listOf()
|
} ?: listOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDrafts(eventId: String): List<Note> {
|
fun getDrafts(eventId: String): List<Note> {
|
||||||
return drafts.filter {
|
return drafts.filter {
|
||||||
it.value.any { it == eventId }
|
it.value.any { it.eventId == eventId }
|
||||||
}.keys.mapNotNull {
|
}.values.map {
|
||||||
checkGetOrCreateNote(it)
|
it.mapNotNull {
|
||||||
|
checkGetOrCreateNote(it.mainId)
|
||||||
}
|
}
|
||||||
|
}.flatten()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addDraft(
|
fun addDraft(
|
||||||
key: String,
|
key: String,
|
||||||
value: String,
|
mainId: String,
|
||||||
|
draftId: String,
|
||||||
) {
|
) {
|
||||||
val data = drafts[key] ?: mutableListOf()
|
val data = drafts[key] ?: mutableListOf()
|
||||||
data.add(value)
|
if (data.none { it.mainId == mainId }) {
|
||||||
|
data.add(Drafts(mainId, draftId))
|
||||||
drafts[key] = data
|
drafts[key] = data
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun getOrCreateUser(key: HexKey): User {
|
fun getOrCreateUser(key: HexKey): User {
|
||||||
// checkNotInMainThread()
|
// checkNotInMainThread()
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ object NostrAccountDataSource : NostrDataSource("AccountData") {
|
|||||||
|
|
||||||
LocalCache.justConsume(it, relay)
|
LocalCache.justConsume(it, relay)
|
||||||
tag?.let { lTag ->
|
tag?.let { lTag ->
|
||||||
LocalCache.addDraft(lTag, it.id())
|
LocalCache.addDraft(lTag, event.id(), it.id())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
Log.d("draft", draft.event!!.toJson())
|
Log.d("draft", draft.event!!.toJson())
|
||||||
|
|
||||||
draftTag = LocalCache.drafts.filter {
|
draftTag = LocalCache.drafts.filter {
|
||||||
it.value.contains(draft.idHex)
|
it.value.any { it.eventId == draft.event?.id() }
|
||||||
}.keys.firstOrNull() ?: draftTag
|
}.keys.firstOrNull() ?: draftTag
|
||||||
|
|
||||||
canAddInvoice = accountViewModel.userProfile().info?.lnAddress() != null
|
canAddInvoice = accountViewModel.userProfile().info?.lnAddress() != null
|
||||||
@@ -394,7 +394,15 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
it.value == draft.event?.tags()?.filter { it.size > 1 && it[0] == "condition" }?.map { it[1] }?.firstOrNull()
|
it.value == draft.event?.tags()?.filter { it.size > 1 && it[0] == "condition" }?.map { it[1] }?.firstOrNull()
|
||||||
} ?: ClassifiedsEvent.CONDITION.USED_LIKE_NEW
|
} ?: ClassifiedsEvent.CONDITION.USED_LIKE_NEW
|
||||||
|
|
||||||
message = TextFieldValue(draft.event?.content() ?: "")
|
message =
|
||||||
|
if (draft.event is PrivateDmEvent) {
|
||||||
|
val event = draft.event as PrivateDmEvent
|
||||||
|
TextFieldValue(event.cachedContentFor(accountViewModel.account.signer) ?: "")
|
||||||
|
} else {
|
||||||
|
TextFieldValue(draft.event?.content() ?: "")
|
||||||
|
}
|
||||||
|
|
||||||
|
nip24 = draft.event is ChatMessageEvent
|
||||||
urlPreview = findUrlInMessage()
|
urlPreview = findUrlInMessage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ fun ChannelCardCompose(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup,
|
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel, newPostViewModel = null) { showPopup,
|
||||||
->
|
->
|
||||||
BlankNote(
|
BlankNote(
|
||||||
remember {
|
remember {
|
||||||
@@ -281,7 +281,7 @@ fun NormalChannelCard(
|
|||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
|
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel, newPostViewModel = null) { showPopup ->
|
||||||
CheckNewAndRenderChannelCard(
|
CheckNewAndRenderChannelCard(
|
||||||
baseNote,
|
baseNote,
|
||||||
routeForLastRead,
|
routeForLastRead,
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ import androidx.lifecycle.map
|
|||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
|
import com.vitorpamplona.amethyst.ui.actions.NewPostViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
||||||
@@ -105,6 +106,7 @@ fun ChatroomMessageCompose(
|
|||||||
innerQuote: Boolean = false,
|
innerQuote: Boolean = false,
|
||||||
parentBackgroundColor: MutableState<Color>? = null,
|
parentBackgroundColor: MutableState<Color>? = null,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
onWantsToReply: (Note) -> Unit,
|
onWantsToReply: (Note) -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -118,11 +120,12 @@ fun ChatroomMessageCompose(
|
|||||||
innerQuote,
|
innerQuote,
|
||||||
parentBackgroundColor,
|
parentBackgroundColor,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
newPostViewModel,
|
||||||
nav,
|
nav,
|
||||||
onWantsToReply,
|
onWantsToReply,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup,
|
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel, newPostViewModel = newPostViewModel) { showPopup,
|
||||||
->
|
->
|
||||||
BlankNote(
|
BlankNote(
|
||||||
remember {
|
remember {
|
||||||
@@ -144,6 +147,7 @@ fun CheckHiddenChatMessage(
|
|||||||
innerQuote: Boolean = false,
|
innerQuote: Boolean = false,
|
||||||
parentBackgroundColor: MutableState<Color>? = null,
|
parentBackgroundColor: MutableState<Color>? = null,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
onWantsToReply: (Note) -> Unit,
|
onWantsToReply: (Note) -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -162,6 +166,7 @@ fun CheckHiddenChatMessage(
|
|||||||
innerQuote,
|
innerQuote,
|
||||||
parentBackgroundColor,
|
parentBackgroundColor,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
newPostViewModel,
|
||||||
nav,
|
nav,
|
||||||
onWantsToReply,
|
onWantsToReply,
|
||||||
)
|
)
|
||||||
@@ -175,6 +180,7 @@ fun LoadedChatMessageCompose(
|
|||||||
innerQuote: Boolean = false,
|
innerQuote: Boolean = false,
|
||||||
parentBackgroundColor: MutableState<Color>? = null,
|
parentBackgroundColor: MutableState<Color>? = null,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
onWantsToReply: (Note) -> Unit,
|
onWantsToReply: (Note) -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -220,6 +226,7 @@ fun LoadedChatMessageCompose(
|
|||||||
canPreview,
|
canPreview,
|
||||||
parentBackgroundColor,
|
parentBackgroundColor,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
newPostViewModel,
|
||||||
nav,
|
nav,
|
||||||
onWantsToReply,
|
onWantsToReply,
|
||||||
)
|
)
|
||||||
@@ -236,6 +243,7 @@ fun NormalChatNote(
|
|||||||
canPreview: Boolean = true,
|
canPreview: Boolean = true,
|
||||||
parentBackgroundColor: MutableState<Color>? = null,
|
parentBackgroundColor: MutableState<Color>? = null,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
onWantsToReply: (Note) -> Unit,
|
onWantsToReply: (Note) -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -347,6 +355,7 @@ fun NormalChatNote(
|
|||||||
availableBubbleSize,
|
availableBubbleSize,
|
||||||
showDetails,
|
showDetails,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
newPostViewModel,
|
||||||
nav,
|
nav,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -357,6 +366,7 @@ fun NormalChatNote(
|
|||||||
popupExpanded = popupExpanded,
|
popupExpanded = popupExpanded,
|
||||||
onDismiss = { popupExpanded = false },
|
onDismiss = { popupExpanded = false },
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
|
newPostViewModel = newPostViewModel,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -374,6 +384,7 @@ private fun RenderBubble(
|
|||||||
availableBubbleSize: MutableState<Int>,
|
availableBubbleSize: MutableState<Int>,
|
||||||
showDetails: State<Boolean>,
|
showDetails: State<Boolean>,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
val bubbleSize = remember { mutableIntStateOf(0) }
|
val bubbleSize = remember { mutableIntStateOf(0) }
|
||||||
@@ -403,6 +414,7 @@ private fun RenderBubble(
|
|||||||
canPreview,
|
canPreview,
|
||||||
showDetails,
|
showDetails,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
newPostViewModel,
|
||||||
nav,
|
nav,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -421,6 +433,7 @@ private fun MessageBubbleLines(
|
|||||||
canPreview: Boolean,
|
canPreview: Boolean,
|
||||||
showDetails: State<Boolean>,
|
showDetails: State<Boolean>,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
if (drawAuthorInfo) {
|
if (drawAuthorInfo) {
|
||||||
@@ -437,6 +450,7 @@ private fun MessageBubbleLines(
|
|||||||
innerQuote = innerQuote,
|
innerQuote = innerQuote,
|
||||||
backgroundBubbleColor = backgroundBubbleColor,
|
backgroundBubbleColor = backgroundBubbleColor,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
|
newPostViewModel = newPostViewModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
onWantsToReply = onWantsToReply,
|
onWantsToReply = onWantsToReply,
|
||||||
)
|
)
|
||||||
@@ -489,11 +503,12 @@ private fun RenderReplyRow(
|
|||||||
innerQuote: Boolean,
|
innerQuote: Boolean,
|
||||||
backgroundBubbleColor: MutableState<Color>,
|
backgroundBubbleColor: MutableState<Color>,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
onWantsToReply: (Note) -> Unit,
|
onWantsToReply: (Note) -> Unit,
|
||||||
) {
|
) {
|
||||||
if (!innerQuote && note.replyTo?.lastOrNull() != null) {
|
if (!innerQuote && note.replyTo?.lastOrNull() != null) {
|
||||||
RenderReply(note, backgroundBubbleColor, accountViewModel, nav, onWantsToReply)
|
RenderReply(note, backgroundBubbleColor, accountViewModel, newPostViewModel, nav, onWantsToReply)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,6 +517,7 @@ private fun RenderReply(
|
|||||||
note: Note,
|
note: Note,
|
||||||
backgroundBubbleColor: MutableState<Color>,
|
backgroundBubbleColor: MutableState<Color>,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
onWantsToReply: (Note) -> Unit,
|
onWantsToReply: (Note) -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -520,6 +536,7 @@ private fun RenderReply(
|
|||||||
innerQuote = true,
|
innerQuote = true,
|
||||||
parentBackgroundColor = backgroundBubbleColor,
|
parentBackgroundColor = backgroundBubbleColor,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
|
newPostViewModel = newPostViewModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
onWantsToReply = onWantsToReply,
|
onWantsToReply = onWantsToReply,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ fun WatchNoteEvent(
|
|||||||
if (it) {
|
if (it) {
|
||||||
onNoteEventFound()
|
onNoteEventFound()
|
||||||
} else {
|
} else {
|
||||||
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
|
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel, newPostViewModel = null) { showPopup ->
|
||||||
BlankNote(
|
BlankNote(
|
||||||
remember {
|
remember {
|
||||||
modifier.combinedClickable(
|
modifier.combinedClickable(
|
||||||
@@ -414,7 +414,7 @@ fun AcceptableNote(
|
|||||||
nav = nav,
|
nav = nav,
|
||||||
)
|
)
|
||||||
else ->
|
else ->
|
||||||
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) {
|
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel, newPostViewModel = null) {
|
||||||
showPopup,
|
showPopup,
|
||||||
->
|
->
|
||||||
CheckNewAndRenderNote(
|
CheckNewAndRenderNote(
|
||||||
@@ -450,7 +450,7 @@ fun AcceptableNote(
|
|||||||
is FileHeaderEvent -> FileHeaderDisplay(baseNote, false, accountViewModel)
|
is FileHeaderEvent -> FileHeaderDisplay(baseNote, false, accountViewModel)
|
||||||
is FileStorageHeaderEvent -> FileStorageHeaderDisplay(baseNote, false, accountViewModel)
|
is FileStorageHeaderEvent -> FileStorageHeaderDisplay(baseNote, false, accountViewModel)
|
||||||
else ->
|
else ->
|
||||||
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) {
|
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel, newPostViewModel = null) {
|
||||||
showPopup,
|
showPopup,
|
||||||
->
|
->
|
||||||
CheckNewAndRenderNote(
|
CheckNewAndRenderNote(
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import androidx.compose.material.icons.filled.AlternateEmail
|
|||||||
import androidx.compose.material.icons.filled.Block
|
import androidx.compose.material.icons.filled.Block
|
||||||
import androidx.compose.material.icons.filled.ContentCopy
|
import androidx.compose.material.icons.filled.ContentCopy
|
||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.Delete
|
||||||
|
import androidx.compose.material.icons.filled.Edit
|
||||||
import androidx.compose.material.icons.filled.FormatQuote
|
import androidx.compose.material.icons.filled.FormatQuote
|
||||||
import androidx.compose.material.icons.filled.PersonAdd
|
import androidx.compose.material.icons.filled.PersonAdd
|
||||||
import androidx.compose.material.icons.filled.PersonRemove
|
import androidx.compose.material.icons.filled.PersonRemove
|
||||||
@@ -84,6 +85,8 @@ import androidx.core.graphics.ColorUtils
|
|||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.model.AddressableNote
|
import com.vitorpamplona.amethyst.model.AddressableNote
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
|
import com.vitorpamplona.amethyst.ui.actions.NewPostView
|
||||||
|
import com.vitorpamplona.amethyst.ui.actions.NewPostViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.components.SelectTextDialog
|
import com.vitorpamplona.amethyst.ui.components.SelectTextDialog
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ReportNoteDialog
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ReportNoteDialog
|
||||||
@@ -132,6 +135,7 @@ val externalLinkForNote = { note: Note ->
|
|||||||
fun LongPressToQuickAction(
|
fun LongPressToQuickAction(
|
||||||
baseNote: Note,
|
baseNote: Note,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
content: @Composable (() -> Unit) -> Unit,
|
content: @Composable (() -> Unit) -> Unit,
|
||||||
) {
|
) {
|
||||||
val popupExpanded = remember { mutableStateOf(false) }
|
val popupExpanded = remember { mutableStateOf(false) }
|
||||||
@@ -140,7 +144,7 @@ fun LongPressToQuickAction(
|
|||||||
|
|
||||||
content(showPopup)
|
content(showPopup)
|
||||||
|
|
||||||
NoteQuickActionMenu(baseNote, popupExpanded.value, hidePopup, accountViewModel)
|
NoteQuickActionMenu(baseNote, popupExpanded.value, hidePopup, accountViewModel, newPostViewModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -149,20 +153,24 @@ fun NoteQuickActionMenu(
|
|||||||
popupExpanded: Boolean,
|
popupExpanded: Boolean,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
) {
|
) {
|
||||||
val showSelectTextDialog = remember { mutableStateOf(false) }
|
val showSelectTextDialog = remember { mutableStateOf(false) }
|
||||||
val showDeleteAlertDialog = remember { mutableStateOf(false) }
|
val showDeleteAlertDialog = remember { mutableStateOf(false) }
|
||||||
val showBlockAlertDialog = remember { mutableStateOf(false) }
|
val showBlockAlertDialog = remember { mutableStateOf(false) }
|
||||||
val showReportDialog = remember { mutableStateOf(false) }
|
val showReportDialog = remember { mutableStateOf(false) }
|
||||||
|
val editDraftDialog = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
if (popupExpanded) {
|
if (popupExpanded) {
|
||||||
RenderMainPopup(
|
RenderMainPopup(
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
newPostViewModel,
|
||||||
note,
|
note,
|
||||||
onDismiss,
|
onDismiss,
|
||||||
showBlockAlertDialog,
|
showBlockAlertDialog,
|
||||||
showDeleteAlertDialog,
|
showDeleteAlertDialog,
|
||||||
showReportDialog,
|
showReportDialog,
|
||||||
|
editDraftDialog,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,16 +207,29 @@ fun NoteQuickActionMenu(
|
|||||||
onDismiss()
|
onDismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (editDraftDialog.value) {
|
||||||
|
NewPostView(
|
||||||
|
onClose = {
|
||||||
|
editDraftDialog.value = false
|
||||||
|
},
|
||||||
|
accountViewModel = accountViewModel,
|
||||||
|
draft = note,
|
||||||
|
nav = { },
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun RenderMainPopup(
|
private fun RenderMainPopup(
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel?,
|
||||||
note: Note,
|
note: Note,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
showBlockAlertDialog: MutableState<Boolean>,
|
showBlockAlertDialog: MutableState<Boolean>,
|
||||||
showDeleteAlertDialog: MutableState<Boolean>,
|
showDeleteAlertDialog: MutableState<Boolean>,
|
||||||
showReportDialog: MutableState<Boolean>,
|
showReportDialog: MutableState<Boolean>,
|
||||||
|
editDraftDialog: MutableState<Boolean>,
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val primaryLight = lightenColor(MaterialTheme.colorScheme.primary, 0.1f)
|
val primaryLight = lightenColor(MaterialTheme.colorScheme.primary, 0.1f)
|
||||||
@@ -279,6 +300,21 @@ private fun RenderMainPopup(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (note.isDraft()) {
|
||||||
|
VerticalDivider(color = primaryLight)
|
||||||
|
NoteQuickActionItem(
|
||||||
|
Icons.Default.Edit,
|
||||||
|
stringResource(R.string.edit_draft),
|
||||||
|
) {
|
||||||
|
if (newPostViewModel != null) {
|
||||||
|
newPostViewModel.load(accountViewModel, null, null, null, null, note)
|
||||||
|
onDismiss()
|
||||||
|
} else {
|
||||||
|
editDraftDialog.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isOwnNote) {
|
if (!isOwnNote) {
|
||||||
VerticalDivider(color = primaryLight)
|
VerticalDivider(color = primaryLight)
|
||||||
|
|
||||||
@@ -389,14 +425,20 @@ fun NoteQuickActionItem(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.size(70.dp).clickable { onClick() },
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.size(70.dp)
|
||||||
|
.clickable { onClick() },
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = icon,
|
imageVector = icon,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.size(24.dp).padding(bottom = 5.dp),
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.size(24.dp)
|
||||||
|
.padding(bottom = 5.dp),
|
||||||
tint = Color.White,
|
tint = Color.White,
|
||||||
)
|
)
|
||||||
Text(text = label, fontSize = 12.sp, color = Color.White, textAlign = TextAlign.Center)
|
Text(text = label, fontSize = 12.sp, color = Color.White, textAlign = TextAlign.Center)
|
||||||
@@ -527,7 +569,10 @@ fun QuickActionAlertDialog(
|
|||||||
text = { Text(textContent) },
|
text = { Text(textContent) },
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(all = 8.dp).fillMaxWidth(),
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.padding(all = 8.dp)
|
||||||
|
.fillMaxWidth(),
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
) {
|
) {
|
||||||
TextButton(onClick = onClickDontShowAgain) {
|
TextButton(onClick = onClickDontShowAgain) {
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ fun NoteDropDownMenu(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
HorizontalDivider(thickness = DividerThickness)
|
HorizontalDivider(thickness = DividerThickness)
|
||||||
if (!note.isDraft()) {
|
if (note.isDraft()) {
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(stringResource(R.string.edit_draft)) },
|
text = { Text(stringResource(R.string.edit_draft)) },
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
|
import com.vitorpamplona.amethyst.ui.actions.NewPostViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.note.ChatroomMessageCompose
|
import com.vitorpamplona.amethyst.ui.note.ChatroomMessageCompose
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
@@ -48,6 +49,7 @@ import com.vitorpamplona.amethyst.ui.theme.HalfPadding
|
|||||||
fun RefreshingChatroomFeedView(
|
fun RefreshingChatroomFeedView(
|
||||||
viewModel: FeedViewModel,
|
viewModel: FeedViewModel,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
routeForLastRead: String,
|
routeForLastRead: String,
|
||||||
onWantsToReply: (Note) -> Unit,
|
onWantsToReply: (Note) -> Unit,
|
||||||
@@ -59,6 +61,7 @@ fun RefreshingChatroomFeedView(
|
|||||||
RenderChatroomFeedView(
|
RenderChatroomFeedView(
|
||||||
viewModel,
|
viewModel,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
newPostViewModel,
|
||||||
listState,
|
listState,
|
||||||
nav,
|
nav,
|
||||||
routeForLastRead,
|
routeForLastRead,
|
||||||
@@ -72,6 +75,7 @@ fun RefreshingChatroomFeedView(
|
|||||||
fun RenderChatroomFeedView(
|
fun RenderChatroomFeedView(
|
||||||
viewModel: FeedViewModel,
|
viewModel: FeedViewModel,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel,
|
||||||
listState: LazyListState,
|
listState: LazyListState,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
routeForLastRead: String,
|
routeForLastRead: String,
|
||||||
@@ -91,6 +95,7 @@ fun RenderChatroomFeedView(
|
|||||||
ChatroomFeedLoaded(
|
ChatroomFeedLoaded(
|
||||||
state,
|
state,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
|
newPostViewModel,
|
||||||
listState,
|
listState,
|
||||||
nav,
|
nav,
|
||||||
routeForLastRead,
|
routeForLastRead,
|
||||||
@@ -108,6 +113,7 @@ fun RenderChatroomFeedView(
|
|||||||
fun ChatroomFeedLoaded(
|
fun ChatroomFeedLoaded(
|
||||||
state: FeedState.Loaded,
|
state: FeedState.Loaded,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostViewModel: NewPostViewModel,
|
||||||
listState: LazyListState,
|
listState: LazyListState,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
routeForLastRead: String,
|
routeForLastRead: String,
|
||||||
@@ -130,6 +136,7 @@ fun ChatroomFeedLoaded(
|
|||||||
baseNote = item,
|
baseNote = item,
|
||||||
routeForLastRead = routeForLastRead,
|
routeForLastRead = routeForLastRead,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
|
newPostViewModel = newPostViewModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
onWantsToReply = onWantsToReply,
|
onWantsToReply = onWantsToReply,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ fun NoteMaster(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteQuickActionMenu(note, popupExpanded, { popupExpanded = false }, accountViewModel)
|
NoteQuickActionMenu(note, popupExpanded, { popupExpanded = false }, accountViewModel, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ import java.text.DateFormat
|
|||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ChannelScreen(
|
fun ChannelScreen(
|
||||||
@@ -307,6 +308,7 @@ fun ChannelScreen(
|
|||||||
RefreshingChatroomFeedView(
|
RefreshingChatroomFeedView(
|
||||||
viewModel = feedViewModel,
|
viewModel = feedViewModel,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
|
newPostViewModel = newPostModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
routeForLastRead = "Channel/${channel.idHex}",
|
routeForLastRead = "Channel/${channel.idHex}",
|
||||||
onWantsToReply = { replyTo.value = it },
|
onWantsToReply = { replyTo.value = it },
|
||||||
@@ -315,7 +317,7 @@ fun ChannelScreen(
|
|||||||
|
|
||||||
Spacer(modifier = DoubleVertSpacer)
|
Spacer(modifier = DoubleVertSpacer)
|
||||||
|
|
||||||
replyTo.value?.let { DisplayReplyingToNote(it, accountViewModel, nav) { replyTo.value = null } }
|
replyTo.value?.let { DisplayReplyingToNote(it, accountViewModel, newPostModel, nav) { replyTo.value = null } }
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
@@ -358,6 +360,8 @@ fun ChannelScreen(
|
|||||||
}
|
}
|
||||||
newPostModel.message = TextFieldValue("")
|
newPostModel.message = TextFieldValue("")
|
||||||
replyTo.value = null
|
replyTo.value = null
|
||||||
|
accountViewModel.deleteDraft(newPostModel.draftTag)
|
||||||
|
newPostModel.draftTag = UUID.randomUUID().toString()
|
||||||
feedViewModel.sendToTop()
|
feedViewModel.sendToTop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -368,6 +372,7 @@ fun ChannelScreen(
|
|||||||
fun DisplayReplyingToNote(
|
fun DisplayReplyingToNote(
|
||||||
replyingNote: Note?,
|
replyingNote: Note?,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
newPostModel: NewPostViewModel,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
onCancel: () -> Unit,
|
onCancel: () -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -386,6 +391,7 @@ fun DisplayReplyingToNote(
|
|||||||
null,
|
null,
|
||||||
innerQuote = true,
|
innerQuote = true,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
|
newPostViewModel = newPostModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
onWantsToReply = {},
|
onWantsToReply = {},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ import kotlinx.coroutines.flow.debounce
|
|||||||
import kotlinx.coroutines.flow.receiveAsFlow
|
import kotlinx.coroutines.flow.receiveAsFlow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ChatroomScreen(
|
fun ChatroomScreen(
|
||||||
@@ -332,6 +333,7 @@ fun ChatroomScreen(
|
|||||||
RefreshingChatroomFeedView(
|
RefreshingChatroomFeedView(
|
||||||
viewModel = feedViewModel,
|
viewModel = feedViewModel,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
|
newPostViewModel = newPostModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
routeForLastRead = "Room/${room.hashCode()}",
|
routeForLastRead = "Room/${room.hashCode()}",
|
||||||
onWantsToReply = {
|
onWantsToReply = {
|
||||||
@@ -343,13 +345,16 @@ fun ChatroomScreen(
|
|||||||
|
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
replyTo.value?.let { DisplayReplyingToNote(it, accountViewModel, nav) { replyTo.value = null } }
|
replyTo.value?.let { DisplayReplyingToNote(it, accountViewModel, newPostModel, nav) { replyTo.value = null } }
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
// LAST ROW
|
// LAST ROW
|
||||||
PrivateMessageEditFieldRow(newPostModel, isPrivate = true, accountViewModel) {
|
PrivateMessageEditFieldRow(newPostModel, isPrivate = true, accountViewModel) {
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
|
accountViewModel.deleteDraft(newPostModel.draftTag)
|
||||||
|
newPostModel.draftTag = UUID.randomUUID().toString()
|
||||||
|
|
||||||
val urls = findURLs(newPostModel.message.text)
|
val urls = findURLs(newPostModel.message.text)
|
||||||
val usedAttachments = newPostModel.nip94attachments.filter { it.urls().intersect(urls.toSet()).isNotEmpty() }
|
val usedAttachments = newPostModel.nip94attachments.filter { it.urls().intersect(urls.toSet()).isNotEmpty() }
|
||||||
|
|
||||||
@@ -361,6 +366,7 @@ fun ChatroomScreen(
|
|||||||
mentions = null,
|
mentions = null,
|
||||||
wantsToMarkAsSensitive = false,
|
wantsToMarkAsSensitive = false,
|
||||||
nip94attachments = usedAttachments,
|
nip94attachments = usedAttachments,
|
||||||
|
draftTag = null,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
accountViewModel.account.sendPrivateMessage(
|
accountViewModel.account.sendPrivateMessage(
|
||||||
|
|||||||
Reference in New Issue
Block a user