Skip to content

fix: use the non-deprecated Live Activities enter/exit on iOS - #68

Merged
fadi-george merged 2 commits into
OneSignal:mainfrom
shivapoudel:fix/ios-live-activities-deprecated-callbacks
Sep 30, 2026
Merged

fadi-george merged 2 commits into
OneSignal:mainfrom
shivapoudel:fix/ios-live-activities-deprecated-callbacks

Conversation

@shivapoudel

@shivapoudel shivapoudel commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Call OneSignal.LiveActivities.enter(_:withToken:) and exit(_:) instead of the deprecated callback variants, removing two iOS build warnings.

Details

Motivation

enterLiveActivity and exitLiveActivity use enter(_:withToken:withSuccess:withFailure:) and exit(_:withSuccess:withFailure:), which are deprecated in the OneSignal iOS SDK, so every app that includes the plugin gets two deprecation warnings.

In the SDK (OneSignalLiveActivitiesManagerImpl.swift), those variants call the plain enter/exit and then always call withSuccess on the main queue. withFailure is never called.

Scope

iOS only. The plugin now calls the plain methods and resolves the call right away. The JS API doesn't change: the promise still resolves and can't reject from the SDK, just as before. The input validation rejects are unchanged.

Two small behavior differences:

  • The promise now resolves right away instead of on the next main-queue tick.
  • If the Live Activities module were missing, the SDK stub never called back, so the promise used to hang. It now resolves. The plugin imports OneSignalLiveActivities directly, so this is not expected in practice.

The plain enter/exit need iOS SDK 5.2.0+, so the SPM minimum is raised from 5.0.0 to 5.2.0. The plugin already used APIs from 5.2.0 or later, and the podspec pins 5.7.0.

Testing

Unit testing

None added. There is no iOS test target for the plugin, and the change only removes callback plumbing.

Manual testing

Applied as a local patch on 1.2.0 in a Capacitor 8 app and built it with Xcode for the iOS simulator and an iPhone. The two deprecation warnings are gone and the build has no warnings. The Live Activity flow itself wasn't exercised; that app doesn't use Live Activities.

Affected code checklist

  • Notifications
  • 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

🤖 Generated with Claude Code

@shivapoudel
shivapoudel requested a review from a team September 25, 2026 13:00
fadi-george
fadi-george previously approved these changes Sep 25, 2026

@fadi-george fadi-george left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

.

The withSuccess/withFailure variants are deprecated in the iOS SDK and
warn at build time. They call the plain enter/exit and then always
invoke withSuccess; withFailure is never called. Call the plain methods
and resolve directly, which keeps the same JS behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shivapoudel
shivapoudel force-pushed the fix/ios-live-activities-deprecated-callbacks branch from e6e2610 to 3d2ad91 Compare September 25, 2026 19:13
@fadi-george

fadi-george commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Hey thanks for the pr. i would try to address these issues. if you can't get to it then I can try to fix myself when I have time:

  • The new comment in enterLiveActivity describes the change instead of the code. Drop it, or reword it (e.g. "SDK only queues the request, no completion or failure signal") and add it to exit too.
  • The description says the promise resolves exactly as before. If the Live Activities module is missing, the SDK stub never called back, so the promise used to hang and now resolves. It also resolves right away instead of on the next main queue tick. Worth mentioning.
  • Side note, not blocking: the plain enter/exit need iOS SDK 5.2.0+, but Package.swift still says from 5.0.0. The plugin already needed 5.2.0+ before this change, so would be good to bump that.

Co-authored-by: Cursor <cursoragent@cursor.com>
@fadi-george
fadi-george merged commit da0436e into OneSignal:main Sep 30, 2026
6 checks passed
@shivapoudel
shivapoudel deleted the fix/ios-live-activities-deprecated-callbacks branch September 30, 2026 00:08
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