From ca9951f9b8858c97b67dd99ad9adeedf2685a2a9 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 21 Aug 2023 18:19:10 -0400 Subject: [PATCH] Fixes the loading of GiftWraps as intents in the app. --- .../ui/screen/loggedIn/LoadRedirectScreen.kt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/LoadRedirectScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/LoadRedirectScreen.kt index 40ef07cef..68e92658b 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/LoadRedirectScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/LoadRedirectScreen.kt @@ -25,6 +25,8 @@ import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.ui.navigation.Route import com.vitorpamplona.quartz.events.ChannelCreateEvent import com.vitorpamplona.quartz.events.ChatroomKeyable +import com.vitorpamplona.quartz.events.GiftWrapEvent +import com.vitorpamplona.quartz.events.SealedGossipEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -75,9 +77,17 @@ fun LoadRedirectScreen(baseNote: Note, accountViewModel: AccountViewModel, nav: LaunchedEffect(key1 = noteState) { scope.launch { - val note = noteState?.note - val event = note?.event - val channelHex = note?.channelHex() + val note = noteState?.note ?: return@launch + var event = note.event + val channelHex = note.channelHex() + + if (event is GiftWrapEvent) { + event = accountViewModel.unwrap(event) + } + + if (event is SealedGossipEvent) { + event = accountViewModel.unseal(event) + } if (event == null) { // stay here, loading