@stream-io/video-react-native-sdk 1.33.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +1 -1
  3. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  4. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +2 -3
  5. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  6. package/dist/commonjs/utils/push/android.js +5 -5
  7. package/dist/commonjs/utils/push/android.js.map +1 -1
  8. package/dist/commonjs/utils/push/internal/ios.js +3 -3
  9. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  10. package/dist/commonjs/utils/push/ios.js +2 -2
  11. package/dist/commonjs/utils/push/ios.js.map +1 -1
  12. package/dist/commonjs/utils/push/libs/callingx.js +6 -3
  13. package/dist/commonjs/utils/push/libs/callingx.js.map +1 -1
  14. package/dist/commonjs/utils/push/setupCallingExpEvents.js +2 -1
  15. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -1
  16. package/dist/commonjs/version.js +1 -1
  17. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +1 -1
  18. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  19. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +2 -3
  20. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  21. package/dist/module/utils/push/android.js +5 -5
  22. package/dist/module/utils/push/android.js.map +1 -1
  23. package/dist/module/utils/push/internal/ios.js +3 -3
  24. package/dist/module/utils/push/internal/ios.js.map +1 -1
  25. package/dist/module/utils/push/ios.js +2 -2
  26. package/dist/module/utils/push/ios.js.map +1 -1
  27. package/dist/module/utils/push/libs/callingx.js +6 -3
  28. package/dist/module/utils/push/libs/callingx.js.map +1 -1
  29. package/dist/module/utils/push/setupCallingExpEvents.js +2 -1
  30. package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -1
  31. package/dist/module/version.js +1 -1
  32. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  33. package/dist/typescript/utils/StreamVideoRN/types.d.ts +12 -7
  34. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  35. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  36. package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -1
  37. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -1
  38. package/dist/typescript/version.d.ts +1 -1
  39. package/expo-config-plugin/dist/index.js +2 -0
  40. package/expo-config-plugin/dist/withCallResources/index.js +31 -0
  41. package/expo-config-plugin/dist/withCallResources/withAndroidRingtone.js +92 -0
  42. package/expo-config-plugin/dist/withCallResources/withIosCallkitIcon.js +97 -0
  43. package/expo-config-plugin/dist/withCallResources/withIosRingtone.js +81 -0
  44. package/expo-config-plugin/dist/withiOSInfoPlist.js +3 -1
  45. package/package.json +5 -5
  46. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +1 -1
  47. package/src/hooks/useAndroidKeepCallAliveEffect.ts +2 -4
  48. package/src/utils/StreamVideoRN/types.ts +12 -7
  49. package/src/utils/push/android.ts +5 -5
  50. package/src/utils/push/internal/ios.ts +4 -4
  51. package/src/utils/push/ios.ts +2 -2
  52. package/src/utils/push/libs/callingx.ts +6 -4
  53. package/src/utils/push/setupCallingExpEvents.ts +4 -1
  54. package/src/version.ts +1 -1
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const config_plugins_1 = require("@expo/config-plugins");
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const SUPPORTED_EXTENSIONS = ['.caf', '.aiff', '.m4a', '.wav'];
40
+ const withIosRingtone = (config, props) => {
41
+ if (!props?.iosRingtone) {
42
+ return config;
43
+ }
44
+ return (0, config_plugins_1.withXcodeProject)(config, (xCodeConfig) => {
45
+ const projectRoot = xCodeConfig.modRequest.projectRoot;
46
+ const sourcePath = path.resolve(projectRoot, props.iosRingtone);
47
+ if (!fs.existsSync(sourcePath)) {
48
+ throw new Error(`[StreamVideo] iOS ringtone file not found: ${sourcePath}. ` +
49
+ `Check that the "iosRingtone" path in your plugin config is correct.`);
50
+ }
51
+ const ext = path.extname(sourcePath).toLowerCase();
52
+ if (!SUPPORTED_EXTENSIONS.includes(ext)) {
53
+ throw new Error(`[StreamVideo] Invalid iOS ringtone format "${ext}". ` +
54
+ `Supported formats: ${SUPPORTED_EXTENSIONS.join(', ')}`);
55
+ }
56
+ const fileName = path.basename(sourcePath);
57
+ const appName = xCodeConfig.modRequest.projectName;
58
+ const destDir = path.join(xCodeConfig.modRequest.platformProjectRoot, appName);
59
+ const destPath = path.join(destDir, fileName);
60
+ // Path relative to the ios/ directory — Xcode needs this to locate the file
61
+ const projectFilePath = path.join(appName, fileName);
62
+ fs.mkdirSync(destDir, { recursive: true });
63
+ fs.copyFileSync(sourcePath, destPath);
64
+ const proj = xCodeConfig.modResults;
65
+ if (!proj.hasFile(fileName)) {
66
+ // Find the main app group by name (Expo projects don't have a "Resources" group,
67
+ // so we can't use addResourceFile which crashes on correctForResourcesPath)
68
+ const appGroupKey = proj.findPBXGroupKey({ name: appName });
69
+ const file = proj.addFile(projectFilePath, appGroupKey, {
70
+ target: proj.getFirstTarget().uuid,
71
+ });
72
+ if (file) {
73
+ file.uuid = proj.generateUuid();
74
+ proj.addToPbxBuildFileSection(file);
75
+ proj.addToPbxResourcesBuildPhase(file);
76
+ }
77
+ }
78
+ return xCodeConfig;
79
+ });
80
+ };
81
+ exports.default = withIosRingtone;
@@ -12,8 +12,10 @@ const withStreamVideoReactNativeSDKiOSInfoPList = (configuration, props) => {
12
12
  }
13
13
  }
14
14
  addBackgroundMode('audio');
15
- if (props?.ringing) {
15
+ if (props?.ringing || props?.iosKeepCallAlive) {
16
16
  addBackgroundMode('voip');
17
+ }
18
+ if (props?.ringing) {
17
19
  addBackgroundMode('fetch');
18
20
  addBackgroundMode('processing');
19
21
  config.modResults['BGTaskSchedulerPermittedIdentifiers'] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-native-sdk",
3
- "version": "1.33.0",
3
+ "version": "1.34.0",
4
4
  "description": "Stream Video SDK for React Native",
5
5
  "author": "https://getstream.io",
6
6
  "homepage": "https://getstream.io/video/docs/react-native/",
@@ -50,8 +50,8 @@
50
50
  "!**/.*"
51
51
  ],
52
52
  "dependencies": {
53
- "@stream-io/video-client": "1.48.0",
54
- "@stream-io/video-react-bindings": "1.15.0",
53
+ "@stream-io/video-client": "1.49.0",
54
+ "@stream-io/video-react-bindings": "1.15.1",
55
55
  "intl-pluralrules": "2.0.1",
56
56
  "react-native-url-polyfill": "^3.0.0",
57
57
  "rxjs": "~7.8.2",
@@ -126,9 +126,9 @@
126
126
  "@react-native-firebase/messaging": "^23.4.0",
127
127
  "@react-native/babel-preset": "^0.81.5",
128
128
  "@stream-io/noise-cancellation-react-native": "^0.7.0",
129
- "@stream-io/react-native-callingx": "^0.1.1",
129
+ "@stream-io/react-native-callingx": "^0.2.0",
130
130
  "@stream-io/react-native-webrtc": "137.2.0",
131
- "@stream-io/video-filters-react-native": "^0.12.1",
131
+ "@stream-io/video-filters-react-native": "^0.12.2",
132
132
  "@testing-library/jest-native": "^5.4.3",
133
133
  "@testing-library/react-native": "13.3.3",
134
134
  "@tsconfig/node18": "^18.2.4",
@@ -88,7 +88,7 @@ export const useIosVoipPushEventsSetupEffect = () => {
88
88
 
89
89
  useEffect(() => {
90
90
  const pushConfig = StreamVideoRN.getConfig().push;
91
- const pushProviderName = pushConfig?.ios.pushProviderName;
91
+ const pushProviderName = pushConfig?.ios?.pushProviderName;
92
92
  const callingx = getCallingxLibIfAvailable();
93
93
 
94
94
  if (Platform.OS !== 'ios' || !client || !pushProviderName || !callingx) {
@@ -53,7 +53,7 @@ async function startForegroundService(call_cid: string) {
53
53
  const foregroundServiceConfig = videoConfig.foregroundService;
54
54
  const notificationTexts = foregroundServiceConfig.android.notificationTexts;
55
55
  const channel = foregroundServiceConfig.android.channel;
56
- const smallIconName = videoConfig.push?.android.smallIcon;
56
+ const smallIconName = videoConfig.push?.android?.smallIcon;
57
57
 
58
58
  // NOTE: we use requestAnimationFrame to ensure that the foreground service is started after all the current UI operations are done
59
59
  // this is a workaround for the crash - android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground()
@@ -89,13 +89,11 @@ export const useAndroidKeepCallAliveEffect = () => {
89
89
  const { useCallCallingState } = useCallStateHooks();
90
90
  const callingState = useCallCallingState();
91
91
 
92
- const isOutgoingCall =
93
- callingState === CallingState.RINGING && call?.isCreatedByMe;
94
92
  const isCallJoined = callingState === CallingState.JOINED;
95
93
  const isRingingCall = call?.ringing;
96
94
 
97
95
  const shouldStartForegroundService =
98
- !foregroundServiceStartedRef.current && (isOutgoingCall || isCallJoined);
96
+ !foregroundServiceStartedRef.current && isCallJoined;
99
97
 
100
98
  useEffect((): (() => void) | undefined => {
101
99
  if (Platform.OS === 'ios' || !activeCallCid) {
@@ -37,7 +37,7 @@ export type StreamVideoConfig = {
37
37
  */
38
38
  publishOptions?: ClientPublishOptions;
39
39
 
40
- ios: {
40
+ ios?: {
41
41
  /**
42
42
  * The name for the alias of push provider used for iOS
43
43
  * Pass undefined if you will not be using stream's push notifications but still want to use the functionality of the SDK
@@ -65,8 +65,13 @@ export type StreamVideoConfig = {
65
65
  * @default 60000 (1 minute)
66
66
  */
67
67
  displayCallTimeout?: number;
68
+ /**
69
+ * Whether to enable ongoing calls.
70
+ * @default false
71
+ */
72
+ enableOngoingCalls?: boolean;
68
73
  };
69
- android: {
74
+ android?: {
70
75
  /**
71
76
  * The small icon to be used for push notifications for Android
72
77
  * Reference the name created (Optional, defaults to 'ic_launcher')
@@ -145,12 +150,12 @@ export type StreamVideoConfig = {
145
150
  ) => string;
146
151
  getBody: (type: NonRingingPushEvent, createdUserName: string) => string;
147
152
  };
153
+ /**
154
+ * Whether to enable ongoing calls.
155
+ * @default false
156
+ */
157
+ enableOngoingCalls?: boolean;
148
158
  };
149
- /**
150
- * Whether to enable ongoing calls.
151
- * @default false
152
- */
153
- enableOngoingCalls?: boolean;
154
159
  /**
155
160
  * Whether to reject calls when the user is busy.
156
161
  * @default false
@@ -40,7 +40,7 @@ export async function initAndroidPushToken(
40
40
  pushConfig: PushConfig,
41
41
  setUnsubscribeListener: (unsubscribe: () => void) => void,
42
42
  ) {
43
- if (Platform.OS !== 'android' || !pushConfig.android.pushProviderName) {
43
+ if (Platform.OS !== 'android' || !pushConfig.android?.pushProviderName) {
44
44
  return;
45
45
  }
46
46
  const logger = videoLoggerSystem.getLogger('initAndroidPushToken');
@@ -69,7 +69,7 @@ export async function initAndroidPushToken(
69
69
  logger.warn('Failed to remove firebase token from stream', err);
70
70
  }
71
71
  });
72
- const push_provider_name = pushConfig.android.pushProviderName;
72
+ const push_provider_name = pushConfig.android?.pushProviderName;
73
73
  logger.debug(`sending firebase token: ${token} for userId: ${userId}`);
74
74
  await client.addDevice(token, 'firebase', push_provider_name);
75
75
  };
@@ -336,9 +336,9 @@ export const firebaseDataHandler = async (
336
336
  }
337
337
 
338
338
  // the other types are call.live_started and call.notification
339
- const callChannel = pushConfig.android.callChannel;
339
+ const callChannel = pushConfig.android?.callChannel;
340
340
  const callNotificationTextGetters =
341
- pushConfig.android.callNotificationTextGetters;
341
+ pushConfig.android?.callNotificationTextGetters;
342
342
  if (!callChannel || !callNotificationTextGetters) {
343
343
  logger.debug(
344
344
  "Can't show call notification as either or both callChannel and callNotificationTextGetters is not provided",
@@ -364,7 +364,7 @@ export const firebaseDataHandler = async (
364
364
  data,
365
365
  android: {
366
366
  sound: callChannel.sound,
367
- smallIcon: pushConfig.android.smallIcon,
367
+ smallIcon: pushConfig.android?.smallIcon,
368
368
  vibrationPattern: callChannel.vibrationPattern,
369
369
  channelId,
370
370
  importance: 4, // high importance
@@ -1,9 +1,9 @@
1
+ import { videoLoggerSystem } from '@stream-io/video-client';
1
2
  import { Platform } from 'react-native';
2
- import { pushUnsubscriptionCallbacks } from './constants';
3
- import { canListenToWS, shouldCallBeClosed } from './utils';
4
3
  import { StreamVideoConfig } from '../../StreamVideoRN/types';
5
- import { videoLoggerSystem } from '@stream-io/video-client';
6
4
  import { getCallingxLib } from '../libs/callingx';
5
+ import { pushUnsubscriptionCallbacks } from './constants';
6
+ import { canListenToWS, shouldCallBeClosed } from './utils';
7
7
 
8
8
  export const onVoipNotificationReceived = async (
9
9
  notification: any,
@@ -43,7 +43,7 @@ export const onVoipNotificationReceived = async (
43
43
  }
44
44
 
45
45
  const call_cid = notification?.stream?.call_cid;
46
- if (!call_cid || Platform.OS !== 'ios' || !pushConfig.ios.pushProviderName) {
46
+ if (!call_cid || Platform.OS !== 'ios' || !pushConfig.ios?.pushProviderName) {
47
47
  return;
48
48
  }
49
49
 
@@ -127,7 +127,7 @@ export async function initIosNonVoipToken(
127
127
  ) {
128
128
  if (
129
129
  Platform.OS !== 'ios' ||
130
- !pushConfig.ios.pushProviderName ||
130
+ !pushConfig.ios?.pushProviderName ||
131
131
  !pushConfig.onTapNonRingingCallNotification
132
132
  ) {
133
133
  return;
@@ -155,7 +155,7 @@ export async function initIosNonVoipToken(
155
155
  );
156
156
  }
157
157
  });
158
- const push_provider_name = pushConfig.ios.pushProviderName;
158
+ const push_provider_name = pushConfig.ios?.pushProviderName;
159
159
  logger.debug('Add device token to stream', token);
160
160
  await client
161
161
  .addDevice(token, 'apn', push_provider_name)
@@ -49,6 +49,9 @@ export function extractCallingExpOptions(
49
49
  if (pushConfig.ios.displayCallTimeout !== undefined) {
50
50
  iosOptions.displayCallTimeout = pushConfig.ios.displayCallTimeout;
51
51
  }
52
+ if (pushConfig.ios.enableOngoingCalls !== undefined) {
53
+ iosOptions.enableOngoingCalls = pushConfig.ios.enableOngoingCalls;
54
+ }
52
55
 
53
56
  if (Object.keys(iosOptions).length > 0) {
54
57
  callingExpOptions.ios = iosOptions;
@@ -66,6 +69,9 @@ export function extractCallingExpOptions(
66
69
  if (pushConfig.android.notificationTexts) {
67
70
  androidOptions.notificationTexts = pushConfig.android.notificationTexts;
68
71
  }
72
+ if (pushConfig.android.enableOngoingCalls !== undefined) {
73
+ androidOptions.enableOngoingCalls = pushConfig.android.enableOngoingCalls;
74
+ }
69
75
  }
70
76
 
71
77
  if (foregroundServiceConfig.android.channel) {
@@ -81,9 +87,5 @@ export function extractCallingExpOptions(
81
87
  pushConfig.shouldRejectCallWhenBusy;
82
88
  }
83
89
 
84
- if (pushConfig?.enableOngoingCalls !== undefined) {
85
- callingExpOptions.enableOngoingCalls = pushConfig?.enableOngoingCalls;
86
- }
87
-
88
90
  return callingExpOptions;
89
91
  }
@@ -23,8 +23,11 @@ export function setupCallingExpEvents(pushConfig: NonNullable<PushConfig>) {
23
23
  const hasPushProvider =
24
24
  (Platform.OS === 'android' && pushConfig.android?.pushProviderName) ||
25
25
  (Platform.OS === 'ios' && pushConfig.ios?.pushProviderName);
26
+ const hasOngoingCalls =
27
+ (Platform.OS === 'android' && pushConfig.android?.enableOngoingCalls) ||
28
+ (Platform.OS === 'ios' && pushConfig.ios?.enableOngoingCalls);
26
29
 
27
- if (!hasPushProvider) {
30
+ if (!hasPushProvider && !hasOngoingCalls) {
28
31
  return;
29
32
  }
30
33
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.33.0';
1
+ export const version = '1.34.0';