Fix the real push-notification crash, add background for the black bar, log widget update failures - #79
Merged
Conversation
…ar has nothing to show, log widget update failures The push-notification-enable crash was never actually fixed by the earlier proguard/double-permission-request changes — got the real Crashlytics stack trace this time, and it's an open, unfixed upstream Capacitor bug (ionic-team/capacitor#8400): Bridge.getPermissionStates() throws a real native NullPointerException when PushNotifications.requestPermissions() is called, crashing the whole app before any JS try/catch ever gets a chance to run. Confirmed present on both 1.0.8 and 1.0.9, unrelated to anything shipped so far this session. Added NotificationPermissionPlugin, a small native plugin that requests POST_NOTIFICATIONS directly with Android's own permission API instead of going through Capacitor's broken helper. enableNativeNotifications() now calls it first, falling back to the old Capacitor call only if that plugin is somehow unavailable. Also: html/body never had an explicit background-color, so the safe-area strip under Android's edge-to-edge status bar could fall back to the WebView's own default canvas color instead of the app's actual background — set explicitly now. And the widget's update call no longer swallows errors silently, so a real failure is visible in the WebView console/logcat instead of just disappearing. Co-authored-by: SableWolphen <309909614+SableWolphen@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Push-notification crash (root cause confirmed via real Crashlytics stack trace):
PushNotifications.requestPermissions()routes throughBridge.getPermissionStates(), a Capacitor core method with an open, unfixed upstream bug (ionic-team/capacitor#8400) — throws a real nativeNullPointerException, a full app crash that no JStry/catchcan ever intercept. Confirmed present on both 1.0.8 and 1.0.9 in Crashlytics, unrelated to the proguard/double-permission-request fixes shipped earlier this session.NotificationPermissionPlugin: requestsPOST_NOTIFICATIONSdirectly with Android's own permission API, sidestepping Capacitor's broken helper entirely.enableNativeNotifications()uses it first, with a fallback to the old Capacitor call only if that plugin is somehow unavailable.Black bar:
html/bodynever had an explicitbackground-color. Android's edge-to-edge extends the WebView under the status bar, and without an explicit background there, that strip can fall back to the WebView's own default canvas color instead of the app's actual color. Set explicitly now.Widget:
updateWidgetcall was silently swallowing any failure (.catch(() => {})). Now logs to the console instead, so a real failure is visible in WebView remote debugging / logcat rather than just disappearing with no trace.Test plan
npm testpassesGenerated by Claude Code