chore: [SDK-5307] remove stale compatibility code for iOS below 15 - #1756
Merged
Merged
Conversation
nan-li
force-pushed
the
nan/sdk-5307
branch
from
September 24, 2026 16:27
689fbc8 to
048ae0e
Compare
nan-li
force-pushed
the
nan/sdk-5307
branch
from
September 24, 2026 16:29
048ae0e to
baebc1a
Compare
nan-li
marked this pull request as ready for review
September 24, 2026 16:31
fadi-george
approved these changes
Sep 25, 2026
fadi-george
left a comment
Collaborator
There was a problem hiding this comment.
Potential issues:
- writeData:error: returns a BOOL, might be cleaner to check that instead of fileHandleError
- OSRemoteLoggingControllerTests still posts "UISceneDidEnterBackgroundNotification" by string, could use UIScene.didEnterBackgroundNotification to match
- NSClassFromString for UNTextInputNotificationResponse / UNPushNotificationTrigger in UNUserNotificationCenter+OneSignalNotifications.m could go too if you want the cleanup to be complete
The deployment target is iOS 15 since #1749, so every `@available(iOS 13.0, *)` and `@available(iOS 14.0, *)` check is always true, and the reflection that avoided linking iOS 13 APIs at compile time is no longer needed. - Register the UIScene lifecycle observers with the UIScene notification constants instead of string names, in the lifecycle observer, the notifications manager and the remote logging controller. - Drop the iOS 13 guard in `OSBundleUtils.isAppUsingUIScene` and the iOS 14 guard around the ephemeral authorization status. - Read the key window's scene through the typed `UIWindowScene` API in `UIApplication+OneSignal` and `OSMessagingController` instead of `performSelector`. - Call `NSFileHandle writeData:error:` directly in the attachment downloader instead of through `NSInvocation`, and drop the pre-13 `writeData:` fallback. - Remove the matching `#available` checks in OneSignalCoreMocks and the iOS 13 and 14 guards in the dev app.
With the Mac Catalyst floor at 15 alongside iOS, the `@available(iOS 15.0, *)` check around notification action buttons is always true, so `createActionForButton:` can call `UNNotificationActionIcon` and `actionWithIdentifier:title:options:icon:` directly instead of going through `NSClassFromString`, `performSelector` and `NSInvocation`. The pre-15 fallback that built the action without an icon goes with it. A button without an icon key still passes a nil icon, as before.
…otifications class lookups Review follow-ups from #1756. - The attachment downloader branches on the BOOL that `writeData:error:` returns instead of testing the error object, which is only defined when the call returns NO. - `OSRemoteLoggingControllerTests` posts the scene background notification through the `UIScene` constant, matching the controller. - The notification center category references `UNTextInputNotificationResponse` and `UNPushNotificationTrigger` directly and reads `userText` through the typed class instead of `NSClassFromString` and key-value coding.
nan-li
force-pushed
the
nan/sdk-5307
branch
from
September 28, 2026 16:58
baebc1a to
6318189
Compare
`OneSignalAttachmentHandlerTests` calls `createActionForButton:` with a system icon, a template icon and no icon key, and checks the identifier, title, foreground option and whether `icon` is set. The method had no live test since the old `testCreateActionForButtonsWithIcon` was commented out with the rest of UnitTests.m.
Contributor
Author
Thanks. All three are in 6318189 Also rebased onto main after #1757 and added |
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.
Description
One Line Summary
Remove the runtime guards and reflection that only existed for iOS 12 through 14, and for iOS 15 on Mac Catalyst. SDK-5307.
Details
Motivation
#1749 raised the deployment target to iOS 15 and #1757 raised Mac Catalyst to match, so every
@available(iOS 13.0, *),@available(iOS 14.0, *)and@available(iOS 15.0, *)check is always true, and theperformSelectorandNSInvocationcalls that avoided linking newer APIs at compile time have no reason left to exist.Scope
OSRemoteLoggingControllerregister UIScene observers with theUIScene*notification constants instead of string names.OSBundleUtils.isAppUsingUISceneand the ephemeral authorization check lose their guards andelsebranches.UIApplication+OneSignalandOSMessagingControllerread the key window's scene through the typedUIWindowSceneAPI. A nil key window still reads as active, as it did throughperformSelector.NSFileHandle writeData:error:directly, branches on its BOOL result, and drops the pre-13writeData:fallback.createActionForButton:buildsUNNotificationActionIconand callsactionWithIdentifier:title:options:icon:directly, and drops the pre-15 fallback that built the action without an icon. A button without an icon key still passes a nil icon.UNTextInputNotificationResponseandUNPushNotificationTriggerdirectly and readsuserTextthrough the typed class.OneSignalCoreMocksand the dev app lose the matching#availablechecks, and the dev app'swillPresentNotificationalways uses the banner and list options.keyWindowreads, the Xcode-eraAUTH_STATUS_EPHEMERALand provisional defines, thesetInspectable:invocation inOneSignalWebViewandOSInAppMessageView(Xcode-era reflection under a 16.4 guard that stays), the literalcom.apple.UNNotification*ActionIdentifierstrings, and the commented-out blocks in the legacyUnitTeststarget.Testing
Unit testing
New
OneSignalAttachmentHandlerTestscallscreateActionForButton:with a system icon, a template icon and no icon key, and checks the identifier, title, foreground option and whethericonis set. The oldtestCreateActionForButtonsWithIconis commented out with the rest of UnitTests.m, so this path had no live test.Coverage of the other edits is narrower than it looks. No test host declares
UIApplicationSceneManifest, so the existing lifecycle tests run theUIApplicationbranches only; the scene branches in the two Objective-C observers and inapplicationIsActivedo not execute under test.OSRemoteLoggingControllerTestsinjects scene mode and covers the remote logging controller's scene branch, now posting through theUISceneconstant. The notification settings tests cover the ephemeral change.Manual testing
Reduced test plan run serially on an iPhone 17 Pro Max simulator with Xcode 27.0: 356 tests, 0 failures.
build-for-testingproduces the same warning set asmain.OneSignalFrameworkandOneSignalInAppMessagesboth build for Mac Catalyst on Xcode 27.0 at the ios15.0-macabi target, which between them compile every touched source file. The dev app builds against the resulting frameworks. Not run on a device.Affected code checklist
Checklist
Overview
Testing
Final pass
🤖 Generated with Claude Code