Surface native iOS APNs registration outcome for diagnostics

Enabling push still fails on iOS with getAPNSToken() returning null, so capture
the APNs registration result natively to find out why. AppDelegate now overrides
didRegister/didFailToRegister, logs the outcome, and exposes it over a
oott/push_diagnostics method channel (super still calls through so Firebase
swizzling is unaffected).

apnsRegistrationStatus() reads that channel, and the settings push toggle now
shows Apple's actual rejection reason in the error message when enabling fails,
so it can be diagnosed without a Mac to read the device console.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-06-09 12:06:11 -04:00
co-authored by Claude Opus 4.8
parent 3d190e847e
commit c7c5b45ae8
3 changed files with 72 additions and 1 deletions
+8 -1
View File
@@ -104,9 +104,16 @@ class _SettingsState extends State<Settings> {
);
} else {
setState(() => _pushEnabled = false);
// On iOS, surface the native APNs registration reason (if any) so the
// failure can be diagnosed without a Mac to read the device console.
final apnsStatus = await apnsRegistrationStatus();
if (!mounted) return;
UISnackbars.showError(
context,
'Could not enable push. Check notification permission for OOTT.',
apnsStatus != null
? 'Could not enable push. $apnsStatus'
: 'Could not enable push. Check notification permission for '
'OOTT.',
);
}
} else {