@@ -25,6 +25,7 @@ import androidx.compose.foundation.layout.Row
2525import androidx.compose.foundation.layout.fillMaxSize
2626import androidx.compose.foundation.layout.fillMaxWidth
2727import androidx.compose.foundation.layout.height
28+ import androidx.compose.foundation.layout.heightIn
2829import androidx.compose.foundation.layout.offset
2930import androidx.compose.foundation.layout.padding
3031import androidx.compose.foundation.layout.size
@@ -68,6 +69,7 @@ import androidx.compose.ui.layout.positionInRoot
6869import androidx.compose.ui.platform.LocalClipboardManager
6970import androidx.compose.ui.platform.LocalContext
7071import androidx.compose.ui.platform.LocalDensity
72+ import androidx.compose.ui.platform.LocalWindowInfo
7173import androidx.compose.ui.res.painterResource
7274import androidx.compose.ui.text.AnnotatedString
7375import androidx.compose.ui.text.font.FontFamily
@@ -148,18 +150,20 @@ private fun SentryBuddyOverlayContent(
148150 controller.action()
149151 state = controller.state
150152 liveFeed = controller.liveFeed
153+ nowMs = System .currentTimeMillis()
151154 }
152155
153156 fun dispatchAnalysis (action : SentryBuddySessionController .() -> Unit ) {
154157 analysisScope.launch {
155158 withContext(Dispatchers .IO ) { controller.action() }
156159 state = controller.state
157160 liveFeed = controller.liveFeed
161+ nowMs = System .currentTimeMillis()
158162 }
159163 }
160164
161165 LaunchedEffect (state) {
162- if (state is SentryBuddySessionState .Recording ) {
166+ if (state ! is SentryBuddySessionState .Closed ) {
163167 while (true ) {
164168 nowMs = System .currentTimeMillis()
165169 delay(1000 )
@@ -487,6 +491,8 @@ private fun BuddySheet(
487491 if (state is SentryBuddySessionState .Closed || state is SentryBuddySessionState .Recording ) {
488492 return
489493 }
494+ val maxSheetHeight =
495+ with (LocalDensity .current) { LocalWindowInfo .current.containerSize.height.toDp() } * 0.75f
490496
491497 ModalBottomSheet (
492498 onDismissRequest = { onDispatch { close() } },
@@ -495,7 +501,11 @@ private fun BuddySheet(
495501 shape = RoundedCornerShape (topStart = 28 .dp, topEnd = 28 .dp),
496502 ) {
497503 Column (
498- modifier = Modifier .fillMaxWidth().verticalScroll(rememberScrollState()).padding(24 .dp),
504+ modifier =
505+ Modifier .fillMaxWidth()
506+ .heightIn(max = maxSheetHeight)
507+ .verticalScroll(rememberScrollState())
508+ .padding(24 .dp),
499509 verticalArrangement = Arrangement .spacedBy(16 .dp),
500510 ) {
501511 when (state) {
@@ -698,49 +708,40 @@ private fun LiveFeedRows(
698708 ) {
699709 Row (
700710 modifier = Modifier .fillMaxWidth().padding(14 .dp),
701- horizontalArrangement = Arrangement .spacedBy(12 .dp),
702- verticalAlignment = Alignment .Top ,
711+ horizontalArrangement = Arrangement .spacedBy(10 .dp),
712+ verticalAlignment = Alignment .CenterVertically ,
703713 ) {
704- Box (modifier = Modifier .size(10 .dp).background(color, CircleShape ).offset(y = 5 .dp))
705- Column (modifier = Modifier .weight(1f ), verticalArrangement = Arrangement .spacedBy(4 .dp)) {
706- Row (
707- modifier = Modifier .fillMaxWidth(),
708- horizontalArrangement = Arrangement .SpaceBetween ,
709- verticalAlignment = Alignment .CenterVertically ,
710- ) {
711- Text (item.title(), color = BuddyInk , fontWeight = FontWeight .Bold )
712- Text (
713- relativeTime(item.timestamp.time, nowMs),
714- color = BuddyMuted ,
715- style = MaterialTheme .typography.labelMedium,
716- )
717- }
718- item.subtitle()?.let {
719- Text (it, color = BuddyMuted , style = MaterialTheme .typography.bodySmall)
720- }
721- Row (horizontalArrangement = Arrangement .spacedBy(10 .dp)) {
722- Text (
723- item.category.label,
724- color = color,
725- style = MaterialTheme .typography.labelMedium,
726- fontWeight = FontWeight .Bold ,
727- )
728- if (link != null ) {
729- Text (
730- " Open in Sentry" ,
731- color = BuddyPurple ,
732- style = MaterialTheme .typography.labelMedium,
733- fontWeight = FontWeight .Bold ,
734- )
735- }
736- }
737- }
714+ LiveFeedCategoryPill (item.category.label, color)
715+ Text (
716+ item.title(),
717+ modifier = Modifier .weight(1f ),
718+ color = BuddyInk ,
719+ fontWeight = FontWeight .Bold ,
720+ )
721+ Text (
722+ relativeTime(item.timestamp.time, nowMs),
723+ color = BuddyMuted ,
724+ style = MaterialTheme .typography.labelMedium,
725+ )
738726 }
739727 }
740728 }
741729 }
742730}
743731
732+ @Composable
733+ private fun LiveFeedCategoryPill (label : String , color : Color ) {
734+ Surface (color = color.copy(alpha = 0.12f ), shape = RoundedCornerShape (18 .dp)) {
735+ Text (
736+ label,
737+ modifier = Modifier .padding(horizontal = 9 .dp, vertical = 5 .dp),
738+ color = color,
739+ style = MaterialTheme .typography.labelSmall,
740+ fontWeight = FontWeight .Bold ,
741+ )
742+ }
743+ }
744+
744745@Composable
745746private fun SentryBuddyGlyph (tint : Color , modifier : Modifier = Modifier ) {
746747 Icon (
@@ -1000,8 +1001,8 @@ private fun Int.positiveChip(label: String): String? = if (this > 0) "$this $lab
10001001
10011002private fun BuddyLiveFeedItem.title (): String =
10021003 when (category) {
1003- BuddyLiveFeedItem .Category .SCREEN -> " Screen: ${ timelineItem.name.orEmpty()} "
1004- BuddyLiveFeedItem .Category .STEP -> " Step: ${ timelineItem.name.orEmpty()} "
1004+ BuddyLiveFeedItem .Category .SCREEN -> timelineItem.name ? : " Unknown screen "
1005+ BuddyLiveFeedItem .Category .STEP -> timelineItem.name ? : " Unnamed step "
10051006 BuddyLiveFeedItem .Category .ERROR -> timelineItem.name ? : " Error captured"
10061007 BuddyLiveFeedItem .Category .FAILED_HTTP -> httpTitle()
10071008 BuddyLiveFeedItem .Category .SLOW_SPAN -> timelineItem.name ? : " Slow span"
0 commit comments