Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): keep Android live activity independent of alerts #24933

MergedPixPMusic(GitHub profile, opens in a new tab)merged 9 commits intomain fromrefs/pull/24933/headmerged by juliusmarminge View on GitHub

Showing 9 changed files with 120 additions and 17 deletions (loading 6).

x
0 of 9 viewed, 9 left
1 addition and 1 deletionapps/mobile/modules/t3-agent-notifications/android/src/main/java/expo/modules/t3agentnotifications/AgentActivityPresentation.ktModified
View file
@@ -115,7 +115,7 @@
​
val chip = when {
- !active -> null
+ !active -> if (phase == ActivityPhase.FAILED) "Failed" else "Done"
phase == null -> data["activity_chip"]?.takeIf { it.isNotBlank() }?.take(7) ?: "Active"
phase == ActivityPhase.RUNNING && activeCount > 1 ->
"${if (activeCount > 9) "9+" else activeCount} live"
7 additions and 7 deletionsapps/mobile/modules/t3-agent-notifications/android/src/main/java/expo/modules/t3agentnotifications/AgentNotifications.ktModified
View file
@@ -297,21 +297,21 @@
val presentation = ActivityPresentation(data, active)
val openThread = contentIntent(context, scheme, data["activity_path"], ACTIVITY_ID)
+ // Retained results still need Android's ongoing flag to remain promoted.
+ val ongoing = active || Build.VERSION.SDK_INT >= 36
val builder = base(context, ACTIVITY_CHANNEL)
- .setOngoing(active).setOnlyAlertOnce(true).setSilent(true)
+ .setOngoing(ongoing).setOnlyAlertOnce(true).setSilent(true)
.setTimeoutAfter(remainingMs)
// Live Updates must remain uncolorized to qualify for promotion.
.setColorized(false)
- .setRequestPromotedOngoing(active)
- .setShortCriticalText(presentation.chip)
+ .setRequestPromotedOngoing(ongoing)
+ .setShortCriticalText(if (ongoing) presentation.chip else null)