mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 01:12:32 +02:00
Fixes DM link in Message Notifications
This commit is contained in:
@@ -26,7 +26,9 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import com.vitorpamplona.amethyst.NotificationCache
|
import com.vitorpamplona.amethyst.NotificationCache
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
|
import com.vitorpamplona.amethyst.model.LocalCache
|
||||||
import com.vitorpamplona.amethyst.service.model.ChannelMessageEvent
|
import com.vitorpamplona.amethyst.service.model.ChannelMessageEvent
|
||||||
|
import com.vitorpamplona.amethyst.service.model.PrivateDmEvent
|
||||||
import com.vitorpamplona.amethyst.ui.screen.MessageSetCard
|
import com.vitorpamplona.amethyst.ui.screen.MessageSetCard
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@@ -64,14 +66,29 @@ fun MessageSetCompose(messageSetCard: MessageSetCard, isInnerNote: Boolean = fal
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier.background(backgroundColor).combinedClickable(
|
modifier = Modifier.background(backgroundColor).combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (noteEvent !is ChannelMessageEvent) {
|
if (noteEvent is ChannelMessageEvent) {
|
||||||
navController.navigate("Note/${note.idHex}") {
|
|
||||||
launchSingleTop = true
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
note.channel()?.let {
|
note.channel()?.let {
|
||||||
navController.navigate("Channel/${it.idHex}")
|
navController.navigate("Channel/${it.idHex}")
|
||||||
}
|
}
|
||||||
|
} else if (noteEvent is PrivateDmEvent) {
|
||||||
|
val replyAuthorBase =
|
||||||
|
(note.event as? PrivateDmEvent)
|
||||||
|
?.recipientPubKey()
|
||||||
|
?.let { LocalCache.getOrCreateUser(it) }
|
||||||
|
|
||||||
|
var userToComposeOn = note.author!!
|
||||||
|
|
||||||
|
if (replyAuthorBase != null) {
|
||||||
|
if (note.author == accountViewModel.userProfile()) {
|
||||||
|
userToComposeOn = replyAuthorBase
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
navController.navigate("Room/${userToComposeOn.pubkeyHex}")
|
||||||
|
} else {
|
||||||
|
navController.navigate("Note/${note.idHex}") {
|
||||||
|
launchSingleTop = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLongClick = { popupExpanded = true }
|
onLongClick = { popupExpanded = true }
|
||||||
|
Reference in New Issue
Block a user