Skip to content

fix: keep APNs token events opt-in - #21

Closed
Just-Insane wants to merge 1 commit into
SableClient:mainfrom
Just-Insane:fix/ios-private-push-token
Closed

fix: keep APNs token events opt-in#21
Just-Insane wants to merge 1 commit into
SableClient:mainfrom
Just-Insane:fix/ios-private-push-token

Conversation

@Just-Insane

@Just-Insane Just-Insane commented Sep 5, 2026

Copy link
Copy Markdown

Summary

  • keep the APNs token available through the awaited native registration result
  • make the duplicate generic push-token renderer event opt-in
  • document the compatibility switch and cover config decoding

Security and compatibility

The default now keeps raw APNs credentials outside the renderer event boundary. Existing JavaScript consumers can preserve the legacy event with plugins.notifications.exposePushTokenEvents: true.

Provenance and audit

  • based on immutable Sable commit 758156fd9b1cbc99c83062194a2a59c411b5907f (current main on 2026-09-05)
  • MIT license and notices retained
  • no dependency, build-script, generated-artifact, or network changes
  • repository is active and unarchived with releases through v0.5.3; no published repository advisories were returned
  • architecture remains the existing native Swift callback plus typed Rust command response

Verification

  • cargo fmt --all -- --check
  • Swift config regression tests added; full platform verification is delegated to repository CI

Copilot AI lite review requested due to automatic review settings September 5, 2026 16:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The opt-in behavior is applied on iOS but macOS still emits push-token unconditionally, which conflicts with the stated cross-Apple-platform APNs token exposure goal.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces a compatibility switch to keep the APNs token available via the awaited push registration call while making the legacy push-token renderer event opt-in (intended to reduce default exposure of raw APNs credentials to the renderer).

Changes:

  • Add exposePushTokenEvents / expose_push_token_events config flag (default false) to control whether the push-token event is emitted.
  • Gate iOS push-token event emission behind that flag and add Swift decoding tests for the new config key.
  • Document the new compatibility switch in the API docs.
File summaries
File Description
src/lib.rs Adds a new plugin config boolean for opting into push-token event emission.
README.md Documents the iOS compatibility switch for legacy push-token events.
ios/Tests/PluginTests/PluginTests.swift Adds Swift decoding coverage for the new config option.
ios/Sources/NotificationPlugin.swift Parses the new config key and stores it on the plugin instance.
ios/Sources/AppDelegateSwizzler.swift Conditionally emits push-token based on the opt-in flag.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 79 to +82
AppDelegateSwizzler.plugin?.handlePushTokenReceived(hex)
try? AppDelegateSwizzler.plugin?.trigger("push-token", data: ["token": hex])
if AppDelegateSwizzler.plugin?.exposePushTokenEvents == true {
try? AppDelegateSwizzler.plugin?.trigger("push-token", data: ["token": hex])
}
Comment thread README.md
Comment on lines +466 to +469
On iOS the APNs token is returned to the caller but is not also emitted through
the generic Tauri event channel by default. Apps that intentionally handle the
raw token in JavaScript can opt into the legacy `push-token` event in
`tauri.conf.json`:
@Just-Insane

Copy link
Copy Markdown
Author

Closing at the Charm maintainer request. No further changes will be proposed from this work.

@Just-Insane Just-Insane closed this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants