From f896bfa526dbd44e14118366796f8196ee071cfb Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 26 Apr 2026 23:47:32 +0000 Subject: [PATCH] feat(audio-rooms): View Profile via nostr: deep-link (T2 #2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The participant context sheet's "View profile" row was previously a TODO comment — AudioRoomActivity is a separate Android activity without its own nav stack. Wire it through MainActivity's existing nostr: URI handler: * encode the target hex as npub via NPub.create(...) * fire ACTION_VIEW on `nostr:npub1...` with explicit MainActivity component (FLAG_ACTIVITY_REORDER_TO_FRONT brings the running instance forward instead of spawning a duplicate) * the audio-room foreground service keeps audio alive while the user is on the profile screen Reuses the existing audio_room_participant_view_profile string. --- .../room/ParticipantHostActionsSheet.kt | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/audiorooms/room/ParticipantHostActionsSheet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/audiorooms/room/ParticipantHostActionsSheet.kt index da73fb1dd..0057e307c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/audiorooms/room/ParticipantHostActionsSheet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/audiorooms/room/ParticipantHostActionsSheet.kt @@ -36,12 +36,15 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.ui.MainActivity import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.quartz.experimental.audiorooms.admin.AdminCommandEvent import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag +import com.vitorpamplona.quartz.nip19Bech32.entities.NPub import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.tags.ROLE import kotlinx.coroutines.launch @@ -111,11 +114,35 @@ internal fun ParticipantHostActionsSheet( style = MaterialTheme.typography.titleSmall, ) Spacer(Modifier.height(8.dp)) - // Audience-side rows. View-profile navigation is - // intentionally omitted in v1: AudioRoomActivity is a - // separate Android Activity without an in-room nav - // stack to push a profile screen onto. Adding it later - // means launching MainActivity with a deep-link Intent. + // View Profile — AudioRoomActivity is a separate Android + // Activity without its own nav stack, so the deep-link + // path goes through MainActivity. Launching `nostr:npub1...` + // via ACTION_VIEW lets the existing MainActivity URI + // handler route to Route.Profile (matches the path that + // an external app or a clicked link inside the feed + // would take). NEW_TASK + REORDER_TO_FRONT brings the + // already-running MainActivity instance forward; the + // audio-room foreground service keeps audio alive while + // the user is on the profile screen. + val context = LocalContext.current + ActionRow(stringRes(R.string.audio_room_participant_view_profile)) { + val npub = NPub.create(target) + runCatching { + context.startActivity( + android.content + .Intent(android.content.Intent.ACTION_VIEW) + .apply { + data = android.net.Uri.parse("nostr:$npub") + setClass(context, MainActivity::class.java) + addFlags( + android.content.Intent.FLAG_ACTIVITY_NEW_TASK or + android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT, + ) + }, + ) + } + onDismiss() + } ActionRow( text = stringRes(