Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): show one Android notification per thread completion #27699

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/27699/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 48 additions and 8 deletions (loading 1).

x
0 of 2 viewed, 2 left
48 additions and 8 deletionsapps/mobile/modules/t3-agent-notifications/android/src/main/java/expo/modules/t3agentnotifications/AgentNotifications.ktModified
View file
@@ -127,8 +127,8 @@
if (registered && fresh && NotificationManagerCompat.from(context).areNotificationsEnabled()) {
channels(context)
val scheme = prefs.getString("scheme", "t3code") ?: "t3code"
- showAlert(context, prefs, scheme, data)
- updateActivity(context, prefs, scheme, data, updatedAt)
+ val alerted = showAlert(context, prefs, scheme, data)
+ updateActivity(context, prefs, data, updatedAt, alerted)
​
@@ -137,7 +137,7 @@
prefs: SharedPreferences,
scheme: String,
data: Map<String, String>
- ) {
+ ): Boolean {
// Queue retries carry the same alert id. Keep a bounded history even when
// notification A is retried after notification B has already arrived.
val alertId = data["alert_id"]
@@ -157,7 +157,14 @@
"seenAlertsOrdered",
(seen.takeLast(63) + alertId).joinToString("\n")
).apply()
+ // Android drops posts to a blocked channel, so that alert shows nothing.
+ return !onScreen && (
+ Build.VERSION.SDK_INT < 26 ||
+ manager(context).getNotificationChannel(ALERT_CHANNEL)?.importance !=