Skip to content

Feat: Add option to disable swizzling#1650

Open
nan-li wants to merge 2 commits intomainfrom
feat/disable_swizzling_option
Open

Feat: Add option to disable swizzling#1650
nan-li wants to merge 2 commits intomainfrom
feat/disable_swizzling_option

Conversation

@nan-li
Copy link
Contributor

@nan-li nan-li commented Mar 2, 2026

Description

One Line Summary

Add option to disable swizzling and add manual integration APIs, when disabled.

Details

Motivation

Allow disabling swizzling for developers to have more control over notification delegate methods.

New Manual Integration APIs

All new manual integration APIs are called on the OneSignal.Notifications namespace:

Method Purpose
didRegisterForRemoteNotifications(_:deviceToken:) Forward APNs device token to OneSignal
handleDidFailRegisterForRemoteNotification(_:) Forward APNs registration failure
receiveRemoteNotification(_:userInfo:completionHandler:) Forward background/silent notifications
handleWillPresentNotificationInForegroundWithPayload(_:withCompletion:) Forward foreground notification for SDK processing
handleNotificationResponse(_:) Forward notification tap/action to SDK
setBadgeCount(_:) Set badge count and sync with SDK cache

How to test

Commit dev app: setup to test swizzle disabled is setup to allow testing

Scope

Swizzling disable option

Testing

Unit testing

None

Manual testing

iPhone on iOS 26.3 with sizzling disabled via Info.plist for:

  • init, APNS token, notification displays, listeners, click handling, permissions, badge count, NSE, etc

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

nan-li added 2 commits March 1, 2026 23:59
- Added APIs for manual notification handling and lifecycle observation when swizzling is disabled.
- Introduced a new constant for controlling swizzling via Info.plist.
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.

1 participant