From b657707af1f42c51f72eda1969e647cd6a6c4a77 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 1 Apr 2026 15:06:33 -0700 Subject: [PATCH 1/3] feat(demo): remove deprecated live activity exit functionality --- examples/demo/src/components/ActionButton.tsx | 9 +++------ .../sections/LiveActivitySection.tsx | 19 ++----------------- examples/demo/src/context/AppContext.tsx | 9 --------- .../src/repositories/OneSignalRepository.ts | 4 ---- examples/demo/src/screens/HomeScreen.tsx | 1 - src/NativeOneSignal.ts | 3 +++ src/index.ts | 1 + 7 files changed, 9 insertions(+), 37 deletions(-) diff --git a/examples/demo/src/components/ActionButton.tsx b/examples/demo/src/components/ActionButton.tsx index 2b72dc6c..c6d6a9cf 100644 --- a/examples/demo/src/components/ActionButton.tsx +++ b/examples/demo/src/components/ActionButton.tsx @@ -6,7 +6,7 @@ import { AppColors, AppSpacing } from '../theme'; interface Props { label: string; onPress: () => void; - variant?: 'primary' | 'destructive' | 'outlined'; + variant?: 'primary' | 'outlined'; disabled?: boolean; loading?: boolean; testID?: string; @@ -29,12 +29,9 @@ export default function ActionButton({ const bgColor = variant === 'primary' ? AppColors.osPrimary : 'transparent'; const borderStyle = - variant === 'outlined' || variant === 'destructive' - ? { borderWidth: 1, borderColor: AppColors.osPrimary } - : {}; + variant === 'outlined' ? { borderWidth: 1, borderColor: AppColors.osPrimary } : {}; - const textColor = - variant === 'outlined' || variant === 'destructive' ? AppColors.osPrimary : AppColors.white; + const textColor = variant === 'outlined' ? AppColors.osPrimary : AppColors.white; return ( void; onUpdate: (activityId: string, eventUpdates: Record) => Promise; onEnd: (activityId: string) => Promise; - onStopUpdating: (activityId: string) => void; onInfoTap?: () => void; } -export default function LiveActivitySection({ - onStart, - onUpdate, - onEnd, - onStopUpdating, - onInfoTap, -}: Props) { +export default function LiveActivitySection({ onStart, onUpdate, onEnd, onInfoTap }: Props) { const [activityId, setActivityId] = useState('order-1'); const [orderNumber, setOrderNumber] = useState('ORD-1234'); const [statusIndex, setStatusIndex] = useState(0); @@ -97,20 +90,12 @@ export default function LiveActivitySection({ testID="update_live_activity_button" /> - onStopUpdating(activityId)} - disabled={!activityId.trim()} - variant="outlined" - testID="stop_updating_live_activity_button" - /> - {/* Requires API key */} onEnd(activityId)} disabled={!activityId.trim()} - variant="destructive" + variant="outlined" testID="end_live_activity_button" /> diff --git a/examples/demo/src/context/AppContext.tsx b/examples/demo/src/context/AppContext.tsx index 0491c1a6..32951cb9 100644 --- a/examples/demo/src/context/AppContext.tsx +++ b/examples/demo/src/context/AppContext.tsx @@ -266,7 +266,6 @@ type AppContextValue = { startDefaultLiveActivity: (activityId: string, attributes: object, content: object) => void; updateLiveActivity: (activityId: string, eventUpdates: Record) => Promise; endLiveActivity: (activityId: string) => Promise; - stopUpdatingLiveActivity: (activityId: string) => void; }; const AppContext = createContext(null); @@ -715,12 +714,6 @@ export function AppContextProvider({ children }: Props) { Toast.show({ type: success ? 'info' : 'error', text1: msg }); }, []); - const stopUpdatingLiveActivity = useCallback((activityId: string) => { - repository.exitLiveActivity(activityId); - log.i(TAG, `Exited Live Activity: ${activityId}`); - Toast.show({ type: 'info', text1: `Exited Live Activity: ${activityId}` }); - }, []); - const contextValue = useMemo( () => ({ state, @@ -757,7 +750,6 @@ export function AppContextProvider({ children }: Props) { startDefaultLiveActivity: startDefaultLiveActivity, updateLiveActivity, endLiveActivity, - stopUpdatingLiveActivity, }), [ state, @@ -794,7 +786,6 @@ export function AppContextProvider({ children }: Props) { startDefaultLiveActivity, updateLiveActivity, endLiveActivity, - stopUpdatingLiveActivity, ], ); diff --git a/examples/demo/src/repositories/OneSignalRepository.ts b/examples/demo/src/repositories/OneSignalRepository.ts index ab51fa30..fbeedd8c 100644 --- a/examples/demo/src/repositories/OneSignalRepository.ts +++ b/examples/demo/src/repositories/OneSignalRepository.ts @@ -193,10 +193,6 @@ class OneSignalRepository { ): Promise { return this.apiService.updateLiveActivity(activityId, event, eventUpdates); } - - exitLiveActivity(activityId: string): void { - OneSignal.LiveActivities.exit(activityId); - } } export default OneSignalRepository; diff --git a/examples/demo/src/screens/HomeScreen.tsx b/examples/demo/src/screens/HomeScreen.tsx index abaf7622..07d453d1 100644 --- a/examples/demo/src/screens/HomeScreen.tsx +++ b/examples/demo/src/screens/HomeScreen.tsx @@ -163,7 +163,6 @@ export default function HomeScreen() { onStart={app.startDefaultLiveActivity} onUpdate={app.updateLiveActivity} onEnd={app.endLiveActivity} - onStopUpdating={app.stopUpdatingLiveActivity} onInfoTap={() => showTooltipModal('liveActivities')} /> )} diff --git a/src/NativeOneSignal.ts b/src/NativeOneSignal.ts index bcd1d5f4..45349521 100644 --- a/src/NativeOneSignal.ts +++ b/src/NativeOneSignal.ts @@ -16,7 +16,10 @@ export interface Spec extends TurboModule { // Live Activities (iOS only, stubs on Android) enterLiveActivity(activityId: string, token: string, callback: (result: Object) => void): void; + + /** @deprecated Use REST API to end live activities instead. */ exitLiveActivity(activityId: string, callback: (result: Object) => void): void; + setPushToStartToken(activityType: string, token: string): void; removePushToStartToken(activityType: string): void; setupDefaultLiveActivity(options: Object | null): void; diff --git a/src/index.ts b/src/index.ts index 1d9cd643..5687f9a0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -175,6 +175,7 @@ export namespace OneSignal { * * Only applies to iOS * + * @deprecated Use the REST API to end live activities instead. * @param activityId: The activity identifier the live activity on this device will no longer receive updates for. **/ export function exit(activityId: string, handler: (result: object) => void = () => {}) { From 8f3bc71496fcc48fe392d703e6c1e84c46ea55ae Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 1 Apr 2026 15:08:55 -0700 Subject: [PATCH 2/3] chore(demo): update react-native-onesignal package hash --- examples/demo/bun.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/demo/bun.lock b/examples/demo/bun.lock index 7f1a2f75..a67d46cf 100644 --- a/examples/demo/bun.lock +++ b/examples/demo/bun.lock @@ -1010,7 +1010,7 @@ "react-native-dotenv": ["react-native-dotenv@3.4.11", "", { "dependencies": { "dotenv": "^16.4.5" }, "peerDependencies": { "@babel/runtime": "^7.20.6" } }, "sha512-6vnIE+WHABSeHCaYP6l3O1BOEhWxKH6nHAdV7n/wKn/sciZ64zPPp2NUdEUf1m7g4uuzlLbjgr+6uDt89q2DOg=="], - "react-native-onesignal": ["react-native-onesignal@../../react-native-onesignal.tgz", { "dependencies": { "invariant": "^2.2.4" }, "peerDependencies": { "react-native": ">=0.76.0" } }, "sha512-TQjsbxq8AF3JQv5csMkmsE/ie8LVFjj2pJBela9u+QyzT5ixNLOYzq+yVUfEnSYwbAGLlqTklswMmvaJacHy8Q=="], + "react-native-onesignal": ["react-native-onesignal@../../react-native-onesignal.tgz", { "dependencies": { "invariant": "^2.2.4" }, "peerDependencies": { "react-native": ">=0.76.0" } }, "sha512-J59lLLkeG/At0U6A2A+uZcfelosOPVPGKy2im7W9V3ru02UQgaTo/juZZnx1lol+1bBqRYqUACTgIxw7LehQEw=="], "react-native-safe-area-context": ["react-native-safe-area-context@5.6.2", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-4XGqMNj5qjUTYywJqpdWZ9IG8jgkS3h06sfVjfw5yZQZfWnRFXczi0GnYyFyCc2EBps/qFmoCH8fez//WumdVg=="], From b5b96fbd6ea26b6162302d39d560c7d297e2a9c5 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 1 Apr 2026 17:20:13 -0700 Subject: [PATCH 3/3] docs: update live activity exit deprecation message --- src/NativeOneSignal.ts | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NativeOneSignal.ts b/src/NativeOneSignal.ts index 45349521..ba2fd5eb 100644 --- a/src/NativeOneSignal.ts +++ b/src/NativeOneSignal.ts @@ -17,7 +17,7 @@ export interface Spec extends TurboModule { // Live Activities (iOS only, stubs on Android) enterLiveActivity(activityId: string, token: string, callback: (result: Object) => void): void; - /** @deprecated Use REST API to end live activities instead. */ + /** @deprecated Currently unsupported, avoid using this method. */ exitLiveActivity(activityId: string, callback: (result: Object) => void): void; setPushToStartToken(activityType: string, token: string): void; diff --git a/src/index.ts b/src/index.ts index 5687f9a0..d2057177 100644 --- a/src/index.ts +++ b/src/index.ts @@ -175,7 +175,7 @@ export namespace OneSignal { * * Only applies to iOS * - * @deprecated Use the REST API to end live activities instead. + * @deprecated Currently unsupported, avoid using this method. * @param activityId: The activity identifier the live activity on this device will no longer receive updates for. **/ export function exit(activityId: string, handler: (result: object) => void = () => {}) {