Skip to content

Commit d064a41

Browse files
authored
chore: deprecate isExpo prop in push config (#2369)
### 💡 Overview isExpo is not used by SDK anymore as we require RN-firebase lib for ringing ### 📝 Implementation notes Deprecated the prop 🎫 Ticket: https://linear.app/stream/issue/XYZ-123 📑 Docs: https://github.com/GetStream/docs-content/pull/<id> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Push notifications now automatically detect the Expo environment. * Removed the need to configure the Expo flag in push settings. * Android push token setup now initializes messaging consistently. * **Deprecations** * The `isExpo` push configuration option is deprecated and will be removed in a future major release. Its value is now ignored. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 8f52b9a commit d064a41

6 files changed

Lines changed: 12 additions & 39 deletions

File tree

packages/react-native-sdk/CLAUDE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ The SDK only handles **ringing call** push notifications. Non-ringing notificati
484484

485485
```tsx
486486
// Safely check if library is installed
487-
const firebase = getFirebaseMessagingLibNoThrow();
488487
const callingx = getCallingxLib();
489488
```
490489

packages/react-native-sdk/src/utils/StreamVideoRN/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export type StreamVideoConfig = {
2626
* @default undefined
2727
*/
2828
push?: {
29+
/**
30+
* @deprecated Expo is auto-detected; this value is ignored and the property will be removed in a future major version.
31+
*/
2932
isExpo?: boolean;
3033
/**
3134
* The publish options to be used when joining a call from a push notification.

packages/react-native-sdk/src/utils/push/android.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ import {
55
} from '@stream-io/video-client';
66
import { AppState, Platform } from 'react-native';
77
import type { StreamVideoConfig } from '../StreamVideoRN/types';
8-
import {
9-
type FirebaseMessagingTypes,
10-
getFirebaseMessagingLib,
11-
getFirebaseMessagingLibNoThrow,
12-
} from './libs';
8+
import { type FirebaseMessagingTypes, getFirebaseMessagingLib } from './libs';
139
import { pushUnsubscriptionCallbacks } from './internal/constants';
1410
import { canListenToWS, shouldCallBeClosed } from './internal/utils';
1511
import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
@@ -60,18 +56,14 @@ export async function initAndroidPushToken(
6056
await client.addDevice(token, 'firebase', push_provider_name);
6157
};
6258

63-
const messaging = pushConfig.isExpo
64-
? getFirebaseMessagingLibNoThrow(true)
65-
: getFirebaseMessagingLib();
66-
if (messaging) {
67-
logger.debug(`setting firebase token listeners`);
68-
const unsubscribe = messaging().onTokenRefresh((refreshedToken) =>
69-
setDeviceToken(refreshedToken),
70-
);
71-
setUnsubscribeListener(unsubscribe);
72-
const token = await messaging().getToken();
73-
await setDeviceToken(token);
74-
}
59+
const messaging = getFirebaseMessagingLib();
60+
logger.debug(`setting firebase token listeners`);
61+
const unsubscribe = messaging().onTokenRefresh((refreshedToken) =>
62+
setDeviceToken(refreshedToken),
63+
);
64+
setUnsubscribeListener(unsubscribe);
65+
const token = await messaging().getToken();
66+
await setDeviceToken(token);
7567
}
7668

7769
/**
Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { lib, type Type } from './lib';
2-
import { videoLoggerSystem } from '@stream-io/video-client';
32

43
export type { FirebaseMessagingTypes } from '@react-native-firebase/messaging';
54
export type FirebaseMessagingType = Type;
@@ -16,21 +15,3 @@ export function getFirebaseMessagingLib(): FirebaseMessagingType {
1615
}
1716
return lib;
1817
}
19-
20-
export function getFirebaseMessagingLibNoThrow(
21-
isExpo: boolean,
22-
): FirebaseMessagingType | undefined {
23-
if (!lib) {
24-
const logger = videoLoggerSystem.getLogger(
25-
'getFirebaseMessagingLibNoThrow',
26-
);
27-
logger.debug(
28-
`${
29-
isExpo
30-
? 'In Expo, @react-native-firebase/messaging library is required to receive ringing notifications in app killed state for Android.'
31-
: ''
32-
}${INSTALLATION_INSTRUCTION}`,
33-
);
34-
}
35-
return lib;
36-
}

sample-apps/react-native/expo-video-sample/utils/setPushConfig.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { registerNonRingingNotificationHandler } from './registerNonRingingNotif
1010

1111
export function setPushConfig() {
1212
StreamVideoRN.setPushConfig({
13-
isExpo: true,
1413
ios: {
1514
pushProviderName: 'rn-expo-apn-video-p8',
1615
},

sample-apps/react-native/ringing-tutorial/utils/setPushConfig.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { Users } from '../constants/Users';
88
const API_KEY = 'par8f5s3gn2j';
99
export function setPushConfig() {
1010
StreamVideoRN.setPushConfig({
11-
isExpo: true,
1211
ios: {
1312
pushProviderName: 'expo-apn-video-ringingtutorial',
1413
},

0 commit comments

Comments
 (0)