From 7257d40ee3146363ad555f8a703b7c898a1d13a2 Mon Sep 17 00:00:00 2001 From: Danny Date: Sat, 7 Nov 2026 17:16:45 -0800 Subject: [PATCH 1/2] Sentry: Show registration status and retry removing the phone --- .../java/com/starpilot/galaxy/SentryPush.kt | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/starpilot/galaxy/SentryPush.kt b/app/src/main/java/com/starpilot/galaxy/SentryPush.kt index 9dcf0a0..67f4387 100644 --- a/app/src/main/java/com/starpilot/galaxy/SentryPush.kt +++ b/app/src/main/java/com/starpilot/galaxy/SentryPush.kt @@ -21,8 +21,27 @@ object SentryPush { val id = p.getString("fcmToken", "").orEmpty().takeIf { it.isNotEmpty() }?.let { java.security.MessageDigest.getInstance("SHA-256").digest(it.toByteArray()).joinToString("") { byte -> "%02x".format(byte) }.take(12) }.orEmpty() - return JSONObject().put("id", id).put("available", FirebaseRegistration.available).put("enabled", p.getBoolean("sentryPushEnabled", false)) - .put("registered", p.getString("fcmRegisteredOrigin", "").orEmpty().isNotEmpty()).toString() + val enabled = p.getBoolean("sentryPushEnabled", false) + val registered = p.getString("fcmRegisteredOrigin", "").orEmpty().isNotEmpty() + val status = when { + !enabled -> if (p.getString("sentryPendingUnsubscribe", "").orEmpty().isNotEmpty()) "Alerts off. Reconnect to comma to remove this phone." else "Alerts off" + !permitted(ctx) -> "Allow notifications in Android Settings to receive Sentry alerts." + registered -> p.getString("fcmAcknowledgement", "").orEmpty().ifEmpty { "Registered" } + p.getString("fcmAcknowledgement", "") == "Registration failed" -> "Couldn't register this phone. Reconnect to comma." + else -> "Registering this phone…" + } + return JSONObject().put("id", id).put("available", FirebaseRegistration.available).put("enabled", enabled) + .put("registered", registered).put("status", status).toString() + } + private fun flushUnsubscribe(ctx: Context, current: SentryApi) { + val p = prefs(ctx) + val old = p.getString("sentryPendingUnsubscribe", "").orEmpty() + if (old.isEmpty()) return + if (p.getBoolean("sentryPushEnabled", false) && old == p.getString("fcmToken", "")) { p.edit().remove("sentryPendingUnsubscribe").apply(); return } + Thread { runCatching { + current.request("/api/sentry/notifications", JSONObject().put("action", "appUnsubscribe").put("token", old)) + if (p.getString("sentryPendingUnsubscribe", "") == old) p.edit().remove("sentryPendingUnsubscribe").apply() + } }.start() } fun enable(ctx: Context, on: Boolean): Boolean { if (on && !permitted(ctx)) return false @@ -34,9 +53,8 @@ object SentryPush { FirebaseRegistration.stop(ctx) SentryPollJob.cancel(ctx) val token = p.getString("fcmToken", "").orEmpty() - val current = api - p.edit().remove("fcmRegisteredOrigin").apply() - Thread { runCatching { current?.request("/api/sentry/notifications", JSONObject().put("action", "appUnsubscribe").put("token", token)) } }.start() + p.edit().remove("fcmRegisteredOrigin").apply { if (token.isNotEmpty()) putString("sentryPendingUnsubscribe", token) }.apply() + api?.let { flushUnsubscribe(ctx, it) } } return true } @@ -47,6 +65,7 @@ object SentryPush { fun registerIfNeeded(ctx: Context, current: SentryApi) { if (suspended) return api = current + flushUnsubscribe(ctx, current) val p = prefs(ctx) if (!p.getBoolean("sentryPushEnabled", false)) return val token = p.getString("fcmToken", "").orEmpty() From 1695c4b6aa42beeecfa26c0f0cc4156e05105ae7 Mon Sep 17 00:00:00 2001 From: dirwin31 <83434411+dirwin31@users.noreply.github.com> Date: Sun, 8 Nov 2026 14:36:08 -0800 Subject: [PATCH 2/2] - Remove Direct checks and Direct branch triggers; retain Play validation. - This changes CI coverage only and does not promote or merge Dev into Distro. --- .github/workflows/checks.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 18b8637..e71a8f4 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -1,9 +1,9 @@ name: Android checks on: pull_request: - branches: [Play-Dev, Direct-Dev, Play-Distro, Direct-Distro] + branches: [Play-Dev, Play-Distro] push: - branches: [Play-Dev, Direct-Dev, Play-Distro, Direct-Distro] + branches: [Play-Dev, Play-Distro] permissions: contents: read jobs: @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - flavor: [Direct, Play] + flavor: [Play] steps: - uses: actions/checkout@v7 - uses: actions/setup-java@v4