Skip to content

feat: [SDK-5193] let an app opt out of subscription ID copy in Info.plist - #1739

Merged
fadi-george merged 2 commits into
mainfrom
nan/sdk-5193
Sep 11, 2026
Merged

feat: [SDK-5193] let an app opt out of subscription ID copy in Info.plist#1739
fadi-george merged 2 commits into
mainfrom
nan/sdk-5193

Conversation

@nan-li

@nan-li nan-li commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Lets an app turn off subscription ID copy with an Info.plist key.

Details

Motivation

The gesture in #1730 is on by default, and the only switch is OneSignal's remote kill switch. An app that doesn't want a pasteboard write in production should be able to say so itself, in its own Info.plist, without a support ticket.

Ticket SDK-5193. Follows #1730, which merged as c23c6f9; this PR targets main.

Scope

OneSignal_disable_subscription_id_copy set to YES in Info.plist

  • read like the SDK's older Info.plist switches (OneSignal_disable_swizzling, OneSignal_suppress_launch_urls, OneSignal_disable_badge_clearing): a Boolean or Number counts by value and a String through NSString.boolValue, so <true/> and <string>YES</string> both opt out. That matters because Xcode's plist editor stores a new row as a String unless its type is changed. A missing or mistyped value leaves the gesture on instead of crashing on boolValue the way the Objective-C reads would.
  • checked before the observers register. With the key set the detector registers nothing, so nothing is counted, written or recorded.
  • That is stricter than the remote kill switch, which still records disabled so we can count attempts; an app that opted out has said no.
  • One INFO line at start says the key was honoured, so a developer can confirm it took. The started latch still flips, so the recovery path's second start() stays quiet.
  • The key names the outcome, not the gesture, so the docs can call the feature one thing.
  • No public API, so the wrapper SDKs expose it with no change.

Other

The docs page and release notes need to say the feature is on by default and name the key.

Testing

Unit testing

OSDeviceGestureDetectorTests injects the opt-out and asserts, through the observer-counting center, that no observers register, that six cycles write nothing and record nothing, and that a second start registers nothing either. OSDeviceGestureDetectorInfoPlistTests deserialises each Info.plist value shape from its literal XML and checks the parse: <true/>, <integer>1</integer>, <real>1.0</real> and the strings YES, yes, true and 1 opt out; <false/>, <integer>0</integer> and the strings NO, false, 0 and empty do not; nil, array, dict, date and data values leave the gesture on. The parse tests fail against the previous NSNumber-only read. 187 OneSignalOSCore tests pass serially, SwiftLint clean apart from the pre-existing file length warning on the test file.

Manual testing

Not run on a device. The read is the same Bundle.main lookup the other Info.plist switches use.

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

@nan-li
nan-li marked this pull request as ready for review September 10, 2026 23:47
Base automatically changed from nan/sdk-5088 to main September 11, 2026 17:25
@nan-li
nan-li requested a review from a team September 11, 2026 17:26
…list

The gesture is on by default and, until now, only OneSignal could turn it
off, through the remote kill switch. An app that does not want a
pasteboard write in production can now set OneSignal_disable_subscription_id_copy
to YES in Info.plist, read the same way as OneSignal_disable_badge_clearing.

With the key set the detector never registers its observers, so nothing
is counted, written or recorded. That is deliberately stricter than the
remote kill switch, which still records disabled so attempts can be
counted: an app that opted out has said no. One INFO line at start says
the key was honored, so a typo in it is not silent. The started latch
still flips, so the recovery path's second start stays quiet.

No public API, so wrapper SDKs need no change to expose it.
@fadi-george

fadi-george commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Potential issues:

  • The Info.plist value is cast only to NSNumber, so string values like YES silently fail and leave copying enabled. Could we support NSString.boolValue too and add coverage for string-backed values?

A String value such as YES now opts out, matching the dynamic boolValue
the other Info.plist keys use, instead of being ignored. Also renames
killSwitchKey to remoteKillSwitchKey to tell the two keys apart.
@nan-li

nan-li commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Potential issues:

  • The Info.plist value is cast only to NSNumber, so string values like YES silently fail and leave copying enabled. Could we support NSString.boolValue too and add coverage for string-backed values?

good find, in 1c7d2d4 String now goes through boolValue like the other keys, with the plist-XML-driven tests in OSDeviceGestureDetectorInfoPlistTests.

@nan-li
nan-li requested a review from fadi-george September 11, 2026 20:13
@fadi-george
fadi-george merged commit 7e5b538 into main Sep 11, 2026
4 checks passed
@fadi-george
fadi-george deleted the nan/sdk-5193 branch September 11, 2026 20:47
@fadi-george

Copy link
Copy Markdown
Collaborator

My bad, I accidentally merged.

@nan-li

nan-li commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

My bad, I accidentally merged.

No probs! thanks for approving

nan-li added a commit that referenced this pull request Sep 11, 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