mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-04-23 06:54:52 +02:00
fixes redirection of routeFor when passing an App Definition Event.
This commit is contained in:
parent
4c1cd1c9ab
commit
d6988ad4e1
@ -26,6 +26,7 @@ import com.vitorpamplona.amethyst.model.User
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
import com.vitorpamplona.quartz.encoders.HexKey
|
||||
import com.vitorpamplona.quartz.events.AddressableEvent
|
||||
import com.vitorpamplona.quartz.events.AppDefinitionEvent
|
||||
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
||||
import com.vitorpamplona.quartz.events.ChatroomKey
|
||||
import com.vitorpamplona.quartz.events.ChatroomKeyable
|
||||
@ -75,6 +76,8 @@ fun routeFor(
|
||||
} else {
|
||||
return "Note/${URLEncoder.encode(noteEvent.id(), "utf-8")}"
|
||||
}
|
||||
} else if (noteEvent is AppDefinitionEvent) {
|
||||
return "ContentDiscovery/${noteEvent.id}"
|
||||
} else if (noteEvent is IsInPublicChatChannel) {
|
||||
noteEvent.channel()?.let {
|
||||
return "Channel/$it"
|
||||
|
@ -424,18 +424,13 @@ fun ClickableNote(
|
||||
.combinedClickable(
|
||||
onClick = {
|
||||
scope.launch {
|
||||
if (baseNote.event is AppDefinitionEvent) {
|
||||
// nav(Route.ContentDiscovery.route + "/${(baseNote.event as AppDefinitionEvent).pubKey()}")
|
||||
nav("ContentDiscovery/${(baseNote.event as AppDefinitionEvent).pubKey()}")
|
||||
} else {
|
||||
val redirectToNote =
|
||||
if (baseNote.event is RepostEvent || baseNote.event is GenericRepostEvent) {
|
||||
baseNote.replyTo?.lastOrNull() ?: baseNote
|
||||
} else {
|
||||
baseNote
|
||||
}
|
||||
routeFor(redirectToNote, accountViewModel.userProfile())?.let { nav(it) }
|
||||
}
|
||||
val redirectToNote =
|
||||
if (baseNote.event is RepostEvent || baseNote.event is GenericRepostEvent) {
|
||||
baseNote.replyTo?.lastOrNull() ?: baseNote
|
||||
} else {
|
||||
baseNote
|
||||
}
|
||||
routeFor(redirectToNote, accountViewModel.userProfile())?.let { nav(it) }
|
||||
}
|
||||
},
|
||||
onLongClick = showPopup,
|
||||
|
Loading…
x
Reference in New Issue
Block a user