@stream-io/video-react-native-sdk 1.20.16 → 1.21.1-alpha.1

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 (95) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +127 -0
  3. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer.js +1 -1
  4. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer.js.map +1 -1
  5. package/dist/commonjs/providers/BusyTonePlayer.js +54 -0
  6. package/dist/commonjs/providers/BusyTonePlayer.js.map +1 -0
  7. package/dist/commonjs/providers/StreamCall/index.js +4 -1
  8. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  9. package/dist/commonjs/providers/StreamVideo.js +3 -2
  10. package/dist/commonjs/providers/StreamVideo.js.map +1 -1
  11. package/dist/commonjs/utils/StreamVideoRN/index.js +16 -0
  12. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  13. package/dist/commonjs/utils/push/android.js +6 -3
  14. package/dist/commonjs/utils/push/android.js.map +1 -1
  15. package/dist/commonjs/utils/push/internal/constants.js +12 -0
  16. package/dist/commonjs/utils/push/internal/constants.js.map +1 -0
  17. package/dist/commonjs/utils/push/internal/ios.js +8 -2
  18. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  19. package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -6
  20. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  21. package/dist/commonjs/utils/push/internal/utils.js +4 -4
  22. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  23. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +20 -14
  24. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +1 -1
  25. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +2 -2
  26. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  27. package/dist/commonjs/version.js +1 -1
  28. package/dist/commonjs/version.js.map +1 -1
  29. package/dist/module/components/Participant/ParticipantView/VideoRenderer.js +1 -1
  30. package/dist/module/components/Participant/ParticipantView/VideoRenderer.js.map +1 -1
  31. package/dist/module/providers/BusyTonePlayer.js +48 -0
  32. package/dist/module/providers/BusyTonePlayer.js.map +1 -0
  33. package/dist/module/providers/StreamCall/index.js +5 -2
  34. package/dist/module/providers/StreamCall/index.js.map +1 -1
  35. package/dist/module/providers/StreamVideo.js +3 -2
  36. package/dist/module/providers/StreamVideo.js.map +1 -1
  37. package/dist/module/utils/StreamVideoRN/index.js +16 -0
  38. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  39. package/dist/module/utils/push/android.js +8 -5
  40. package/dist/module/utils/push/android.js.map +1 -1
  41. package/dist/module/utils/push/internal/constants.js +6 -0
  42. package/dist/module/utils/push/internal/constants.js.map +1 -0
  43. package/dist/module/utils/push/internal/ios.js +10 -4
  44. package/dist/module/utils/push/internal/ios.js.map +1 -1
  45. package/dist/module/utils/push/internal/rxSubjects.js +0 -5
  46. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  47. package/dist/module/utils/push/internal/utils.js +5 -5
  48. package/dist/module/utils/push/internal/utils.js.map +1 -1
  49. package/dist/module/utils/push/setupIosCallKeepEvents.js +20 -14
  50. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +1 -1
  51. package/dist/module/utils/push/setupIosVoipPushEvents.js +2 -2
  52. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  53. package/dist/module/version.js +1 -1
  54. package/dist/module/version.js.map +1 -1
  55. package/dist/typescript/components/Participant/ParticipantView/VideoRenderer.d.ts.map +1 -1
  56. package/dist/typescript/providers/BusyTonePlayer.d.ts +6 -0
  57. package/dist/typescript/providers/BusyTonePlayer.d.ts.map +1 -0
  58. package/dist/typescript/providers/StreamCall/index.d.ts.map +1 -1
  59. package/dist/typescript/providers/StreamVideo.d.ts.map +1 -1
  60. package/dist/typescript/utils/StreamVideoRN/index.d.ts +9 -0
  61. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  62. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  63. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  64. package/dist/typescript/utils/push/internal/constants.d.ts +8 -0
  65. package/dist/typescript/utils/push/internal/constants.d.ts.map +1 -0
  66. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  67. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -6
  68. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  69. package/dist/typescript/utils/push/internal/utils.d.ts +1 -1
  70. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  71. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +1 -1
  72. package/dist/typescript/version.d.ts +1 -1
  73. package/dist/typescript/version.d.ts.map +1 -1
  74. package/expo-config-plugin/dist/withAppDelegate.js +20 -0
  75. package/ios/StreamVideoReactNative.h +4 -0
  76. package/ios/StreamVideoReactNative.m +276 -0
  77. package/ios/StreamVideoReactNative.xcodeproj/project.pbxproj +29 -1
  78. package/ios/StreamVideoReactNative.xcodeproj/project.xcworkspace/xcuserdata/santhoshvaiyapuri.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  79. package/ios/StreamVideoReactNative.xcodeproj/xcuserdata/santhoshvaiyapuri.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  80. package/package.json +6 -6
  81. package/src/components/Participant/ParticipantView/VideoRenderer.tsx +1 -6
  82. package/src/providers/BusyTonePlayer.tsx +71 -0
  83. package/src/providers/StreamCall/index.tsx +7 -5
  84. package/src/providers/StreamVideo.tsx +4 -4
  85. package/src/utils/StreamVideoRN/index.ts +16 -0
  86. package/src/utils/StreamVideoRN/types.ts +1 -0
  87. package/src/utils/push/android.ts +7 -9
  88. package/src/utils/push/internal/constants.ts +10 -0
  89. package/src/utils/push/internal/ios.ts +14 -11
  90. package/src/utils/push/internal/rxSubjects.ts +0 -10
  91. package/src/utils/push/internal/utils.ts +4 -7
  92. package/src/utils/push/setupIosCallKeepEvents.ts +30 -19
  93. package/src/utils/push/setupIosVoipPushEvents.ts +2 -2
  94. package/src/version.ts +1 -1
  95. package/CHANGELOG.md +0 -2746
@@ -1,10 +1,8 @@
1
- import { getLogger, RxUtils } from '@stream-io/video-client';
1
+ import { getLogger } from '@stream-io/video-client';
2
2
  import { AppState, NativeModules, Platform } from 'react-native';
3
3
  import { getCallKeepLib, getVoipPushNotificationLib } from '../libs';
4
- import {
5
- pushUnsubscriptionCallbacks$,
6
- voipPushNotificationCallCId$,
7
- } from './rxSubjects';
4
+ import { voipPushNotificationCallCId$ } from './rxSubjects';
5
+ import { pushUnsubscriptionCallbacks } from './constants';
8
6
  import { canAddPushWSSubscriptionsRef, shouldCallBeEnded } from './utils';
9
7
  import { StreamVideoConfig } from '../../StreamVideoRN/types';
10
8
 
@@ -46,6 +44,7 @@ export const onVoipNotificationReceived = async (
46
44
  }
47
45
  const logger = getLogger(['setupIosVoipPushEvents']);
48
46
  const client = await pushConfig.createStreamVideoClient();
47
+
49
48
  if (!client) {
50
49
  logger(
51
50
  'debug',
@@ -53,6 +52,13 @@ export const onVoipNotificationReceived = async (
53
52
  );
54
53
  return;
55
54
  }
55
+ const shouldRejectCallWhenBusy = client['rejectCallWhenBusy'] ?? false;
56
+ if (shouldRejectCallWhenBusy) {
57
+ // inform the iOS native module that we should reject call when busy
58
+ NativeModules.StreamVideoReactNative.setShouldRejectCallWhenBusy(
59
+ shouldRejectCallWhenBusy,
60
+ );
61
+ }
56
62
  const callFromPush = await client.onRingingCall(call_cid);
57
63
  let uuid = '';
58
64
  try {
@@ -116,12 +122,9 @@ export const onVoipNotificationReceived = async (
116
122
  unsubscribe();
117
123
  }
118
124
  });
119
- const unsubscriptionCallbacks =
120
- RxUtils.getCurrentValue(pushUnsubscriptionCallbacks$) ?? [];
121
- pushUnsubscriptionCallbacks$.next([
122
- ...unsubscriptionCallbacks,
123
- unsubscribe,
124
- ]);
125
+
126
+ pushUnsubscriptionCallbacks.get(call_cid)?.forEach((cb) => cb());
127
+ pushUnsubscriptionCallbacks.set(call_cid, [unsubscribe]);
125
128
  }
126
129
  // send the info to this subject, it is listened by callkeep events
127
130
  // callkeep events will then accept/reject the call
@@ -69,13 +69,3 @@ export const voipCallkeepCallOnForegroundMap$ = new BehaviorSubject<
69
69
  export const voipCallkeepAcceptedCallOnNativeDialerMap$ = new BehaviorSubject<
70
70
  CallkeepMap | undefined
71
71
  >(undefined);
72
-
73
- type UnsubscribeCallback = () => void;
74
-
75
- /**
76
- * This rxjs subject is used to store the unsubscribe callbacks (if any) of the push notification processing
77
- * Note: it should be used to clear it when app processes push notification from foreground
78
- */
79
- export const pushUnsubscriptionCallbacks$ = new BehaviorSubject<
80
- UnsubscribeCallback[] | undefined
81
- >(undefined);
@@ -2,7 +2,6 @@ import {
2
2
  Call,
3
3
  CallingState,
4
4
  getLogger,
5
- RxUtils,
6
5
  StreamVideoClient,
7
6
  } from '@stream-io/video-client';
8
7
  import type {
@@ -10,7 +9,7 @@ import type {
10
9
  StreamVideoConfig,
11
10
  } from '../../StreamVideoRN/types';
12
11
  import { onNewCallNotification } from '../../internal/newNotificationCallbacks';
13
- import { pushUnsubscriptionCallbacks$ } from './rxSubjects';
12
+ import { pushUnsubscriptionCallbacks } from './constants';
14
13
 
15
14
  type PushConfig = NonNullable<StreamVideoConfig['push']>;
16
15
 
@@ -174,14 +173,12 @@ export const processNonIncomingCallFromPush = async (
174
173
  * This function is used to clear all the push related WS subscriptions
175
174
  * note: events are subscribed in push for accept/decline through WS
176
175
  */
177
- export const clearPushWSEventSubscriptions = () => {
178
- const unsubscriptionCallbacks = RxUtils.getCurrentValue(
179
- pushUnsubscriptionCallbacks$,
180
- );
176
+ export const clearPushWSEventSubscriptions = (call_cid: string) => {
177
+ const unsubscriptionCallbacks = pushUnsubscriptionCallbacks.get(call_cid);
181
178
  if (unsubscriptionCallbacks) {
182
179
  unsubscriptionCallbacks.forEach((cb) => cb());
180
+ pushUnsubscriptionCallbacks.delete(call_cid);
183
181
  }
184
- pushUnsubscriptionCallbacks$.next(undefined);
185
182
  };
186
183
 
187
184
  /**
@@ -37,24 +37,29 @@ export function setupIosCallKeepEvents(
37
37
  const callkeep = getCallKeepLib();
38
38
 
39
39
  async function getCallCid(callUUID: string): Promise<string | undefined> {
40
- let call_cid = RxUtils.getCurrentValue(voipPushNotificationCallCId$);
41
- if (!call_cid) {
42
- // if call_cid is not available, try to get it from native module
43
- try {
44
- call_cid =
45
- await NativeModules?.StreamVideoReactNative?.getIncomingCallCid(
46
- callUUID,
47
- );
48
- voipPushNotificationCallCId$.next(call_cid);
49
- } catch (error) {
40
+ try {
41
+ const call_cid =
42
+ await NativeModules.StreamVideoReactNative.getIncomingCallCid(callUUID);
43
+ // in a case that voipPushNotificationCallCId$ is empty (this should not happen as voipPushNotificationCallCId$ is updated in push reception)]
44
+ // update it with this call_cid
45
+ const voipPushNotificationCallCId = RxUtils.getCurrentValue(
46
+ voipPushNotificationCallCId$,
47
+ );
48
+ if (!voipPushNotificationCallCId) {
50
49
  logger(
51
50
  'debug',
52
- 'Error in getting call cid from native module - probably the call was already processed, so ignoring this callkeep event',
53
- error,
51
+ `voipPushNotificationCallCId$ is empty, updating it with the call_cid: ${call_cid} for callUUID: ${callUUID}`,
54
52
  );
53
+ voipPushNotificationCallCId$.next(call_cid);
55
54
  }
55
+ return call_cid;
56
+ } catch {
57
+ logger(
58
+ 'debug',
59
+ `Error in getting call cid from native module for callUUID: ${callUUID} - probably the call was already processed, so ignoring this callkeep event`,
60
+ );
56
61
  }
57
- return call_cid;
62
+ return undefined;
58
63
  }
59
64
 
60
65
  function answerCall(callUUID: string) {
@@ -150,7 +155,7 @@ const iosCallkeepAcceptCall = (
150
155
  if (!shouldProcessCallFromCallkeep(call_cid, callUUIDFromCallkeep)) {
151
156
  return;
152
157
  }
153
- clearPushWSEventSubscriptions();
158
+ clearPushWSEventSubscriptions(call_cid);
154
159
  // to call end callkeep later if ended in app and not through callkeep
155
160
  voipCallkeepAcceptedCallOnNativeDialerMap$.next({
156
161
  uuid: callUUIDFromCallkeep,
@@ -170,11 +175,17 @@ const iosCallkeepRejectCall = async (
170
175
  if (!shouldProcessCallFromCallkeep(call_cid, callUUIDFromCallkeep)) {
171
176
  return;
172
177
  }
173
- clearPushWSEventSubscriptions();
174
- // no need to keep these references anymore
175
- voipCallkeepAcceptedCallOnNativeDialerMap$.next(undefined);
176
- voipCallkeepCallOnForegroundMap$.next(undefined);
177
- voipPushNotificationCallCId$.next(undefined);
178
+ clearPushWSEventSubscriptions(call_cid);
179
+ // remove the references if the call_cid matches
180
+ const voipPushNotificationCallCId = RxUtils.getCurrentValue(
181
+ voipPushNotificationCallCId$,
182
+ );
183
+ if (voipPushNotificationCallCId === call_cid) {
184
+ voipCallkeepAcceptedCallOnNativeDialerMap$.next(undefined);
185
+ voipCallkeepCallOnForegroundMap$.next(undefined);
186
+ voipPushNotificationCallCId$.next(undefined);
187
+ }
188
+
178
189
  await processCallFromPushInBackground(pushConfig, call_cid, 'decline');
179
190
  await NativeModules.StreamVideoReactNative?.removeIncomingCall(call_cid);
180
191
  };
@@ -13,11 +13,11 @@ export function setupIosVoipPushEvents(
13
13
  return;
14
14
  }
15
15
  const logger = getLogger(['setupIosVoipPushEvents']);
16
- if (!pushConfig.android.incomingCallChannel) {
16
+ if (!pushConfig.ios.pushProviderName) {
17
17
  // TODO: remove this check and find a better way once we have telecom integration for android
18
18
  logger(
19
19
  'debug',
20
- 'android incomingCallChannel is not defined, so skipping the setupIosVoipPushEvents',
20
+ 'ios pushProviderName is not defined, so skipping the setupIosVoipPushEvents',
21
21
  );
22
22
  return;
23
23
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.20.16';
1
+ export const version = '1.21.0';