@stream-io/video-react-native-sdk 1.29.0-beta.1 → 1.29.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 (198) hide show
  1. package/CHANGELOG.md +3114 -0
  2. package/android/src/main/AndroidManifest.xml +1 -8
  3. package/android/src/main/AndroidManifestNew.xml +0 -11
  4. package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +5 -42
  5. package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +6 -70
  6. package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +4 -6
  7. package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +95 -0
  8. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +160 -0
  9. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
  10. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
  11. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  12. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +97 -64
  13. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  14. package/dist/commonjs/index.js +0 -1
  15. package/dist/commonjs/index.js.map +1 -1
  16. package/dist/commonjs/modules/call-manager/CallManager.js +0 -26
  17. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  18. package/dist/commonjs/providers/StreamCall/index.js +6 -6
  19. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  20. package/dist/commonjs/utils/StreamVideoRN/index.js +21 -33
  21. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  22. package/dist/commonjs/utils/internal/registerSDKGlobals.js +3 -52
  23. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  24. package/dist/commonjs/utils/push/android.js +200 -145
  25. package/dist/commonjs/utils/push/android.js.map +1 -1
  26. package/dist/commonjs/utils/push/internal/ios.js +34 -16
  27. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  28. package/dist/commonjs/utils/push/internal/rxSubjects.js +20 -1
  29. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  30. package/dist/commonjs/utils/push/internal/utils.js +1 -17
  31. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  32. package/dist/commonjs/utils/push/ios.js.map +1 -1
  33. package/dist/commonjs/utils/push/libs/callkeep.js +17 -0
  34. package/dist/commonjs/utils/push/libs/callkeep.js.map +1 -0
  35. package/dist/commonjs/utils/push/libs/index.js +19 -8
  36. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  37. package/dist/commonjs/utils/push/libs/notifee/index.js +19 -0
  38. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  39. package/dist/commonjs/utils/push/libs/voipPushNotification.js +17 -0
  40. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +1 -0
  41. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +205 -0
  42. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +1 -0
  43. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +6 -7
  44. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  45. package/dist/commonjs/version.js +1 -1
  46. package/dist/commonjs/version.js.map +1 -1
  47. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +153 -0
  48. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
  49. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
  50. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  51. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +99 -66
  52. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  53. package/dist/module/index.js +0 -1
  54. package/dist/module/index.js.map +1 -1
  55. package/dist/module/modules/call-manager/CallManager.js +0 -26
  56. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  57. package/dist/module/providers/StreamCall/index.js +6 -6
  58. package/dist/module/providers/StreamCall/index.js.map +1 -1
  59. package/dist/module/utils/StreamVideoRN/index.js +21 -33
  60. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  61. package/dist/module/utils/internal/registerSDKGlobals.js +4 -53
  62. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  63. package/dist/module/utils/push/android.js +202 -147
  64. package/dist/module/utils/push/android.js.map +1 -1
  65. package/dist/module/utils/push/internal/ios.js +34 -16
  66. package/dist/module/utils/push/internal/ios.js.map +1 -1
  67. package/dist/module/utils/push/internal/rxSubjects.js +19 -0
  68. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  69. package/dist/module/utils/push/internal/utils.js +0 -14
  70. package/dist/module/utils/push/internal/utils.js.map +1 -1
  71. package/dist/module/utils/push/ios.js.map +1 -1
  72. package/dist/module/utils/push/libs/callkeep.js +11 -0
  73. package/dist/module/utils/push/libs/callkeep.js.map +1 -0
  74. package/dist/module/utils/push/libs/index.js +2 -1
  75. package/dist/module/utils/push/libs/index.js.map +1 -1
  76. package/dist/module/utils/push/libs/notifee/index.js +18 -0
  77. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  78. package/dist/module/utils/push/libs/voipPushNotification.js +11 -0
  79. package/dist/module/utils/push/libs/voipPushNotification.js.map +1 -0
  80. package/dist/module/utils/push/setupIosCallKeepEvents.js +199 -0
  81. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +1 -0
  82. package/dist/module/utils/push/setupIosVoipPushEvents.js +6 -7
  83. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  84. package/dist/module/version.js +1 -1
  85. package/dist/module/version.js.map +1 -1
  86. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +5 -0
  87. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +1 -0
  88. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  89. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  90. package/dist/typescript/index.d.ts +0 -1
  91. package/dist/typescript/index.d.ts.map +1 -1
  92. package/dist/typescript/modules/call-manager/CallManager.d.ts +0 -5
  93. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  94. package/dist/typescript/utils/StreamVideoRN/index.d.ts +2 -20
  95. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  96. package/dist/typescript/utils/StreamVideoRN/types.d.ts +29 -54
  97. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  98. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  99. package/dist/typescript/utils/push/android.d.ts +2 -1
  100. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  101. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  102. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +12 -0
  103. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  104. package/dist/typescript/utils/push/internal/utils.d.ts +0 -4
  105. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  106. package/dist/typescript/utils/push/ios.d.ts +2 -1
  107. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  108. package/dist/typescript/utils/push/libs/callkeep.d.ts +3 -0
  109. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +1 -0
  110. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts +2 -16
  111. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
  112. package/dist/typescript/utils/push/libs/index.d.ts +2 -1
  113. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  114. package/dist/typescript/utils/push/libs/notifee/index.d.ts +1 -0
  115. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  116. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +3 -0
  117. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +1 -0
  118. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +6 -0
  119. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +1 -0
  120. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  121. package/dist/typescript/version.d.ts +1 -1
  122. package/dist/typescript/version.d.ts.map +1 -1
  123. package/expo-config-plugin/dist/withAndroidManifest.js +33 -1
  124. package/expo-config-plugin/dist/withAndroidPermissions.js +7 -2
  125. package/expo-config-plugin/dist/withAppDelegate.js +197 -19
  126. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  127. package/expo-config-plugin/dist/withiOSInfoPlist.js +3 -2
  128. package/ios/StreamInCallManager.m +0 -2
  129. package/ios/StreamInCallManager.swift +5 -20
  130. package/ios/StreamVideoReactNative.h +4 -7
  131. package/ios/StreamVideoReactNative.m +82 -191
  132. package/package.json +17 -12
  133. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +235 -0
  134. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +34 -21
  135. package/src/hooks/useAndroidKeepCallAliveEffect.ts +120 -94
  136. package/src/index.ts +0 -1
  137. package/src/modules/call-manager/CallManager.ts +0 -36
  138. package/src/modules/call-manager/native-module.d.ts +0 -7
  139. package/src/providers/StreamCall/index.tsx +6 -6
  140. package/src/utils/StreamVideoRN/index.ts +30 -40
  141. package/src/utils/StreamVideoRN/types.ts +29 -56
  142. package/src/utils/internal/registerSDKGlobals.ts +4 -47
  143. package/src/utils/push/android.ts +308 -223
  144. package/src/utils/push/internal/ios.ts +46 -25
  145. package/src/utils/push/internal/rxSubjects.ts +29 -0
  146. package/src/utils/push/internal/utils.ts +0 -25
  147. package/src/utils/push/ios.ts +6 -1
  148. package/src/utils/push/libs/callkeep.ts +16 -0
  149. package/src/utils/push/libs/index.ts +2 -1
  150. package/src/utils/push/libs/notifee/index.ts +27 -0
  151. package/src/utils/push/libs/voipPushNotification.ts +17 -0
  152. package/src/utils/push/setupIosCallKeepEvents.ts +252 -0
  153. package/src/utils/push/setupIosVoipPushEvents.ts +7 -11
  154. package/src/version.ts +1 -1
  155. package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +0 -83
  156. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +0 -134
  157. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +0 -216
  158. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
  159. package/dist/commonjs/utils/internal/audioSessionPromise.js +0 -46
  160. package/dist/commonjs/utils/internal/audioSessionPromise.js.map +0 -1
  161. package/dist/commonjs/utils/internal/callingx.js +0 -84
  162. package/dist/commonjs/utils/internal/callingx.js.map +0 -1
  163. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +0 -48
  164. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +0 -1
  165. package/dist/commonjs/utils/push/libs/callingx.js +0 -75
  166. package/dist/commonjs/utils/push/libs/callingx.js.map +0 -1
  167. package/dist/commonjs/utils/push/setupCallingExpEvents.js +0 -97
  168. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +0 -1
  169. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +0 -209
  170. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
  171. package/dist/module/utils/internal/audioSessionPromise.js +0 -39
  172. package/dist/module/utils/internal/audioSessionPromise.js.map +0 -1
  173. package/dist/module/utils/internal/callingx.js +0 -75
  174. package/dist/module/utils/internal/callingx.js.map +0 -1
  175. package/dist/module/utils/keepCallAliveHeadlessTask.js +0 -42
  176. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +0 -1
  177. package/dist/module/utils/push/libs/callingx.js +0 -67
  178. package/dist/module/utils/push/libs/callingx.js.map +0 -1
  179. package/dist/module/utils/push/setupCallingExpEvents.js +0 -91
  180. package/dist/module/utils/push/setupCallingExpEvents.js.map +0 -1
  181. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +0 -5
  182. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +0 -1
  183. package/dist/typescript/utils/internal/audioSessionPromise.d.ts +0 -16
  184. package/dist/typescript/utils/internal/audioSessionPromise.d.ts.map +0 -1
  185. package/dist/typescript/utils/internal/callingx.d.ts +0 -13
  186. package/dist/typescript/utils/internal/callingx.d.ts.map +0 -1
  187. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +0 -10
  188. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +0 -1
  189. package/dist/typescript/utils/push/libs/callingx.d.ts +0 -9
  190. package/dist/typescript/utils/push/libs/callingx.d.ts.map +0 -1
  191. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +0 -8
  192. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +0 -1
  193. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +0 -307
  194. package/src/utils/internal/audioSessionPromise.ts +0 -39
  195. package/src/utils/internal/callingx.ts +0 -108
  196. package/src/utils/keepCallAliveHeadlessTask.ts +0 -54
  197. package/src/utils/push/libs/callingx.ts +0 -90
  198. package/src/utils/push/setupCallingExpEvents.ts +0 -117
@@ -1,91 +0,0 @@
1
- import { pushAcceptedIncomingCallCId$ } from './internal/rxSubjects';
2
- import { videoLoggerSystem } from '@stream-io/video-client';
3
- import { clearPushWSEventSubscriptions, processCallFromPushInBackground } from './internal/utils';
4
- import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
5
- import { resolvePendingAudioSession } from '../internal/audioSessionPromise';
6
- import { getCallingxLib } from './libs/callingx';
7
- import { Platform } from 'react-native';
8
- const logger = videoLoggerSystem.getLogger('Callingx');
9
-
10
- /**
11
- * This hook is used to listen to callkeep events and do the necessary actions
12
- */
13
- export function setupCallingExpEvents(pushConfig) {
14
- const hasPushProvider = Platform.OS === 'android' && pushConfig.android?.pushProviderName || Platform.OS === 'ios' && pushConfig.ios?.pushProviderName;
15
- if (!hasPushProvider) {
16
- return;
17
- }
18
- const callingx = getCallingxLib();
19
- const {
20
- remove: removeAnswerCall
21
- } = callingx.addEventListener('answerCall', onAcceptCall);
22
- const {
23
- remove: removeEndCall
24
- } = callingx.addEventListener('endCall', onEndCall(pushConfig));
25
- const {
26
- remove: removeDidActivateAudioSession
27
- } = callingx.addEventListener('didActivateAudioSession', onDidActivateAudioSession);
28
- const {
29
- remove: removeDidDeactivateAudioSession
30
- } = callingx.addEventListener('didDeactivateAudioSession', onDidDeactivateAudioSession);
31
-
32
- //NOTE: until getInitialEvents invocation, events are delayed and won't be sent to event listeners, this is a way to make sure none of required events are missed
33
- //in most cases there will be no delayed answers or ends, but it we don't want to miss any of them
34
- const events = callingx.getInitialEvents();
35
- events.forEach(event => {
36
- const {
37
- eventName,
38
- params
39
- } = event;
40
- if (eventName === 'answerCall') {
41
- logger.debug(`answerCall delayed event callId: ${params?.callId}`);
42
- onAcceptCall(params);
43
- } else if (eventName === 'endCall') {
44
- logger.debug(`endCall delayed event callId: ${params?.callId}`);
45
- onEndCall(pushConfig)(params);
46
- } else if (eventName === 'didActivateAudioSession') {
47
- onDidActivateAudioSession();
48
- } else if (eventName === 'didDeactivateAudioSession') {
49
- onDidDeactivateAudioSession();
50
- }
51
- });
52
- setPushLogoutCallback(async () => {
53
- removeAnswerCall();
54
- removeEndCall();
55
- removeDidActivateAudioSession();
56
- removeDidDeactivateAudioSession();
57
- });
58
- }
59
- const onDidActivateAudioSession = () => {
60
- logger.debug('callingExpDidActivateAudioSession');
61
- resolvePendingAudioSession();
62
- };
63
- const onDidDeactivateAudioSession = () => {
64
- logger.debug('callingExpDidDeactivateAudioSession');
65
- };
66
- const onAcceptCall = ({
67
- callId: call_cid,
68
- source
69
- }) => {
70
- logger.debug(`onAcceptCall event callId: ${call_cid} source: ${source}`);
71
- if (source === 'app' || !call_cid) {
72
- //we only need to process the call if the call was answered from the system
73
- return;
74
- }
75
- clearPushWSEventSubscriptions(call_cid);
76
- // to process the call in the app
77
- pushAcceptedIncomingCallCId$.next(call_cid);
78
- };
79
- const onEndCall = pushConfig => async ({
80
- callId: call_cid,
81
- source
82
- }) => {
83
- logger.debug(`onEndCall event callId: ${call_cid} source: ${source}`);
84
- if (source === 'app' || !call_cid) {
85
- //we only need to process the call if the call was rejected from the system
86
- return;
87
- }
88
- clearPushWSEventSubscriptions(call_cid);
89
- await processCallFromPushInBackground(pushConfig, call_cid, 'decline');
90
- };
91
- //# sourceMappingURL=setupCallingExpEvents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["pushAcceptedIncomingCallCId$","videoLoggerSystem","clearPushWSEventSubscriptions","processCallFromPushInBackground","setPushLogoutCallback","resolvePendingAudioSession","getCallingxLib","Platform","logger","getLogger","setupCallingExpEvents","pushConfig","hasPushProvider","OS","android","pushProviderName","ios","callingx","remove","removeAnswerCall","addEventListener","onAcceptCall","removeEndCall","onEndCall","removeDidActivateAudioSession","onDidActivateAudioSession","removeDidDeactivateAudioSession","onDidDeactivateAudioSession","events","getInitialEvents","forEach","event","eventName","params","debug","callId","call_cid","source","next"],"sourceRoot":"../../../../src","sources":["utils/push/setupCallingExpEvents.ts"],"mappings":"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","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- /**
2
- * This hook is used to inform sync call state with CallKit/Telecom (i.e. start call, end call, mute/unmute call).
3
- */
4
- export declare const useCallingExpWithCallingStateEffect: () => void;
5
- //# sourceMappingURL=useCallingExpWithCallingStateEffect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCallingExpWithCallingStateEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useCallingExpWithCallingStateEffect.ts"],"names":[],"mappings":"AAmDA;;GAEG;AACH,eAAO,MAAM,mCAAmC,YA4P/C,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Module to manage pending promise for audio session activation.
3
- * Used to wait for iOS CallKit's didActivateAudioSession event after starting a call.
4
- */
5
- /**
6
- * Creates a promise that resolves when the audio session is activated,
7
- * or after a timeout to prevent hanging indefinitely.
8
- * @returns Promise that resolves when audio session is activated or timeout occurs
9
- */
10
- export declare function waitForAudioSessionActivation(): Promise<void>;
11
- /**
12
- * Resolves the pending audio session activation promise.
13
- * Called when the didActivateAudioSession event fires or on timeout.
14
- */
15
- export declare function resolvePendingAudioSession(): void;
16
- //# sourceMappingURL=audioSessionPromise.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audioSessionPromise.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/audioSessionPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ7D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CASjD"}
@@ -1,13 +0,0 @@
1
- import { Call, MemberResponse, StreamVideoParticipant } from '@stream-io/video-client';
2
- /**
3
- * Gets the call display name. To be used for display in native call screen.
4
- */
5
- export declare function getCallDisplayName(callMembers: MemberResponse[] | undefined, participants: StreamVideoParticipant[] | undefined, currentUserId: string | undefined): string;
6
- /**
7
- * Starts the call in the callingx library.
8
- * Must be called for all outgoing calls
9
- * and optionally for non-ringing calls when ongoing calls are enabled.
10
- */
11
- export declare function startCallingxCall(call: Call): Promise<void>;
12
- export declare function endCallingxCall(call: Call): Promise<void>;
13
- //# sourceMappingURL=callingx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"callingx.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/callingx.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,IAAI,EACJ,cAAc,EACd,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AAKjC;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,cAAc,EAAE,GAAG,SAAS,EACzC,YAAY,EAAE,sBAAsB,EAAE,GAAG,SAAS,EAClD,aAAa,EAAE,MAAM,GAAG,SAAS,UA+BlC;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,iBAiCjD;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,iBAY/C"}
@@ -1,10 +0,0 @@
1
- import type { Call } from '@stream-io/video-client';
2
- export declare const KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = "StreamVideoKeepCallAlive";
3
- /**
4
- * The keep-alive headless task needs access to the active `Call` instance.
5
- * The keep-alive hook will set this reference before starting the native service.
6
- */
7
- export declare const keepCallAliveCallRef: {
8
- current: Call | undefined;
9
- };
10
- //# sourceMappingURL=keepCallAliveHeadlessTask.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keepCallAliveHeadlessTask.d.ts","sourceRoot":"","sources":["../../../src/utils/keepCallAliveHeadlessTask.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,eAAO,MAAM,kCAAkC,6BAA6B,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE;IAAE,OAAO,EAAE,IAAI,GAAG,SAAS,CAAA;CAE7D,CAAC"}
@@ -1,9 +0,0 @@
1
- import { StreamVideoConfig } from '../../StreamVideoRN/types';
2
- export type RNCallingxType = import('@stream-io/react-native-callingx').ICallingxModule;
3
- export type EventData = import('@stream-io/react-native-callingx').EventData;
4
- export type EventParams = import('@stream-io/react-native-callingx').EventParams;
5
- export type CallingExpOptions = import('@stream-io/react-native-callingx').CallingExpOptions;
6
- export declare function getCallingxLib(): import("@stream-io/react-native-callingx").ICallingxModule;
7
- export declare function getCallingxLibIfAvailable(): import("@stream-io/react-native-callingx").ICallingxModule | undefined;
8
- export declare function extractCallingExpOptions(config: StreamVideoConfig): CallingExpOptions;
9
- //# sourceMappingURL=callingx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"callingx.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/libs/callingx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,MAAM,cAAc,GACxB,OAAO,kCAAkC,EAAE,eAAe,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,OAAO,kCAAkC,EAAE,SAAS,CAAC;AAC7E,MAAM,MAAM,WAAW,GACrB,OAAO,kCAAkC,EAAE,WAAW,CAAC;AACzD,MAAM,MAAM,iBAAiB,GAC3B,OAAO,kCAAkC,EAAE,iBAAiB,CAAC;AAQ/D,wBAAgB,cAAc,+DAK7B;AAED,wBAAgB,yBAAyB,2EAExC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,CA4DnB"}
@@ -1,8 +0,0 @@
1
- import type { StreamVideoConfig } from '../StreamVideoRN/types';
2
- type PushConfig = NonNullable<StreamVideoConfig['push']>;
3
- /**
4
- * This hook is used to listen to callkeep events and do the necessary actions
5
- */
6
- export declare function setupCallingExpEvents(pushConfig: NonNullable<PushConfig>): void;
7
- export {};
8
- //# sourceMappingURL=setupCallingExpEvents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupCallingExpEvents.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/setupCallingExpEvents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAchE,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAIzD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,QAqDxE"}
@@ -1,307 +0,0 @@
1
- import { CallingState, videoLoggerSystem } from '@stream-io/video-client';
2
- import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
3
- import { useEffect, useMemo, useRef } from 'react';
4
- import { getCallDisplayName } from '../../utils/internal/callingx';
5
- import { getCallingxLibIfAvailable } from '../../utils/push/libs/callingx';
6
-
7
- const logger = videoLoggerSystem.getLogger(
8
- 'Callingx - useCallingExpWithCallingStateEffect',
9
- );
10
-
11
- //calling state methods are not exhaustive, so we need to add more methods to cover different cases
12
- const canActivateCall = (
13
- prevState: CallingState | undefined,
14
- currentState: CallingState | undefined,
15
- ) => {
16
- if (!prevState && !currentState) {
17
- return false;
18
- }
19
-
20
- const isJoined = (state: CallingState | undefined) => {
21
- if (!state) {
22
- return false;
23
- }
24
-
25
- return state === CallingState.JOINING || state === CallingState.JOINED;
26
- };
27
-
28
- return !isJoined(prevState) && isJoined(currentState);
29
- };
30
-
31
- const canEndCall = (
32
- prevState: CallingState | undefined,
33
- currentState: CallingState | undefined,
34
- ) => {
35
- if (!prevState && !currentState) {
36
- return false;
37
- }
38
-
39
- return (
40
- (prevState === CallingState.JOINED ||
41
- prevState === CallingState.JOINING ||
42
- prevState === CallingState.RINGING ||
43
- prevState === CallingState.RECONNECTING ||
44
- prevState === CallingState.MIGRATING ||
45
- prevState === CallingState.OFFLINE) &&
46
- (currentState === CallingState.LEFT ||
47
- currentState === CallingState.RECONNECTING_FAILED ||
48
- currentState === CallingState.IDLE)
49
- );
50
- };
51
-
52
- /**
53
- * This hook is used to inform sync call state with CallKit/Telecom (i.e. start call, end call, mute/unmute call).
54
- */
55
- export const useCallingExpWithCallingStateEffect = () => {
56
- const {
57
- useCallCallingState,
58
- // useMicrophoneState,
59
- useParticipants,
60
- useCallMembers,
61
- } = useCallStateHooks();
62
-
63
- const activeCall = useCall();
64
- const callingState = useCallCallingState();
65
- // const { isMute, microphone } = useMicrophoneState();
66
- const callMembers = useCallMembers();
67
- const participants = useParticipants();
68
-
69
- const prevState = useRef<CallingState | undefined>(undefined);
70
-
71
- const activeCallCid = activeCall?.cid;
72
- const isIncomingCall = activeCall?.ringing && !activeCall?.isCreatedByMe;
73
- const isOutcomingCall = activeCall?.ringing && activeCall?.isCreatedByMe;
74
- const currentUserId = activeCall?.currentUserId;
75
- const isVideoCall = activeCall?.state.settings?.video?.enabled ?? false;
76
-
77
- const callDisplayName = useMemo(
78
- () => getCallDisplayName(callMembers, participants, currentUserId),
79
- [callMembers, participants, currentUserId],
80
- );
81
-
82
- useEffect(() => {
83
- return () => {
84
- const callingx = getCallingxLibIfAvailable();
85
- if (!callingx?.isSetup || !activeCallCid) {
86
- return;
87
- }
88
-
89
- const isCallRegistered = callingx.isCallRegistered(activeCallCid);
90
- if (!isCallRegistered) {
91
- logger.debug(
92
- `No active call cid to end in calling exp: ${activeCallCid} isCallRegistered: ${isCallRegistered}`,
93
- );
94
- return;
95
- }
96
- //if incoming stream call was unmounted, we need to end the call in CallKit/Telecom
97
- logger.debug(`Ending call in callingx: ${activeCallCid}`);
98
- callingx
99
- .endCallWithReason(activeCallCid, 'local')
100
- .catch((error: unknown) => {
101
- logger.error(
102
- `Error ending call in callingx: ${activeCallCid}`,
103
- error,
104
- );
105
- });
106
- };
107
- }, [activeCallCid]);
108
-
109
- useEffect(() => {
110
- const callingx = getCallingxLibIfAvailable();
111
- if (
112
- !callingx?.isSetup ||
113
- !activeCallCid ||
114
- prevState.current === callingState
115
- ) {
116
- return;
117
- }
118
-
119
- //tells if call is registered in CallKit/Telecom
120
- const isCallRegistered = callingx.isCallRegistered(activeCallCid);
121
- logger.debug(
122
- `useEffect: ${activeCallCid} isCallRegistered: ${isCallRegistered}
123
- isIncomingCall: ${isIncomingCall} isOutcomingCall: ${isOutcomingCall}
124
- prevState: ${prevState.current}, currentState: ${callingState}
125
- isOngoingCallsEnabled: ${callingx.isOngoingCallsEnabled}`,
126
- );
127
-
128
- if (
129
- isIncomingCall &&
130
- isCallRegistered &&
131
- canActivateCall(prevState.current, callingState)
132
- ) {
133
- logger.debug(`Should accept call in callingx: ${activeCallCid}`);
134
- callingx.answerIncomingCall(activeCallCid).catch((error: unknown) => {
135
- logger.error(
136
- `Error answering call in callingx: ${activeCallCid}`,
137
- error,
138
- );
139
- });
140
- } else if (
141
- (isOutcomingCall || callingx.isOngoingCallsEnabled) &&
142
- isCallRegistered &&
143
- canActivateCall(prevState.current, callingState)
144
- ) {
145
- logger.debug(`Should set call active in callingx: ${activeCallCid}`);
146
- callingx.setCurrentCallActive(activeCallCid);
147
- } else if (
148
- isCallRegistered &&
149
- canEndCall(prevState.current, callingState)
150
- ) {
151
- //in case call was registered as incoming and state changed to "not joined", we need to end the call and clear rxjs subject
152
- logger.debug(`Should end call in callingx: ${activeCallCid}`);
153
- //TODO: think about sending appropriate reason for end call
154
- callingx
155
- .endCallWithReason(activeCallCid, 'local')
156
- .catch((error: unknown) => {
157
- logger.error(
158
- `Error ending call in callingx: ${activeCallCid}`,
159
- error,
160
- );
161
- });
162
- }
163
-
164
- prevState.current = callingState;
165
- }, [
166
- activeCallCid,
167
- callingState,
168
- callDisplayName,
169
- isIncomingCall,
170
- isOutcomingCall,
171
- isVideoCall,
172
- ]);
173
-
174
- useEffect(() => {
175
- const callingx = getCallingxLibIfAvailable();
176
- if (!callingx?.isSetup || !activeCallCid) {
177
- return;
178
- }
179
-
180
- const isCallRegistered = callingx.isCallRegistered(activeCallCid);
181
- if (!isCallRegistered) {
182
- logger.debug(
183
- `No active call cid to update callingx: ${activeCallCid} isCallRegistered: ${isCallRegistered}`,
184
- );
185
- return;
186
- }
187
-
188
- callingx.updateDisplay(activeCallCid, activeCallCid, callDisplayName);
189
- }, [activeCallCid, callDisplayName]);
190
-
191
- useEffect(() => {
192
- const callingx = getCallingxLibIfAvailable();
193
- if (!callingx?.isSetup || !activeCallCid || !isIncomingCall) {
194
- return;
195
- }
196
-
197
- let isUnsubscribed = false;
198
- const subscription = callingx.addEventListener(
199
- 'didDisplayIncomingCall',
200
- (event: { callId: string }) => {
201
- if (event.callId === activeCallCid) {
202
- //we need to report the call as answered only if user accepts the call from the app UI and push notification was delivered after that
203
- const _callingState = activeCall?.state.callingState;
204
- const shouldSkip =
205
- _callingState !== CallingState.JOINING &&
206
- _callingState !== CallingState.JOINED &&
207
- _callingState !== CallingState.RECONNECTING &&
208
- _callingState !== CallingState.MIGRATING;
209
- if (shouldSkip) {
210
- return;
211
- }
212
-
213
- logger.debug(
214
- `Reporting the incoming call as answered in callingx as already join() calledin the app: ${activeCallCid}`,
215
- );
216
- callingx
217
- .answerIncomingCall(activeCallCid)
218
- .catch((error: unknown) => {
219
- logger.error(
220
- `Error answering call in callingx: ${activeCallCid}`,
221
- error,
222
- );
223
- })
224
- .finally(() => {
225
- subscription.remove();
226
- isUnsubscribed = true;
227
- });
228
- }
229
- },
230
- );
231
-
232
- return () => {
233
- if (!isUnsubscribed) {
234
- subscription.remove();
235
- }
236
- };
237
- }, [activeCall, activeCallCid, isIncomingCall]);
238
-
239
- // useEffect(() => {
240
- // const callingx = getCallingxLibIfAvailable();
241
- // if (!callingx?.isSetup || !activeCallCid) {
242
- // return;
243
- // }
244
-
245
- // const isCallRegistered = callingx.isCallRegistered(activeCallCid);
246
- // if (!isCallRegistered) {
247
- // logger.debug(
248
- // `No active call cid to set muted in calling exp: ${activeCallCid} isCallRegistered: ${isCallRegistered}`,
249
- // );
250
- // return;
251
- // }
252
-
253
- // callingx.setMutedCall(activeCallCid, isMute);
254
- // }, [activeCallCid, isMute]);
255
-
256
- // useEffect(() => {
257
- // const callingx = getCallingxLibIfAvailable();
258
- // if (!callingx?.isSetup || !activeCallCid) {
259
- // return;
260
- // }
261
-
262
- // const isCallRegistered = callingx.isCallRegistered(activeCallCid);
263
- // if (!isCallRegistered) {
264
- // logger.debug(
265
- // `No active call cid to set muted in calling exp: ${activeCallCid} isCallRegistered: ${isCallRegistered}`,
266
- // );
267
- // return;
268
- // }
269
-
270
- // //listen to mic toggle events from CallKit/Telecom and update stream call microphone state
271
- // const subscription = callingx.addEventListener(
272
- // 'didPerformSetMutedCallAction',
273
- // async (event: { callId: string; muted: boolean }) => {
274
- // const { callId, muted } = event;
275
-
276
- // if (callId === activeCallCid) {
277
- // const isCurrentlyMuted =
278
- // RxUtils.getCurrentValue(microphone.state.status$) === 'disabled';
279
- // if (isCurrentlyMuted === muted) {
280
- // logger.debug(
281
- // `Mic toggle is already in the desired state: ${muted} for call: ${activeCallCid}`,
282
- // );
283
- // //this check prevents mic toggle when state change was initiated from client and not from CallKit/Telecom
284
- // return;
285
- // }
286
-
287
- // try {
288
- // if (muted) {
289
- // await microphone.disable();
290
- // } else {
291
- // await microphone.enable();
292
- // }
293
- // } catch (error: unknown) {
294
- // logger.error(
295
- // `Error toggling mic in calling exp: ${activeCallCid}`,
296
- // error,
297
- // );
298
- // }
299
- // }
300
- // },
301
- // );
302
-
303
- // return () => {
304
- // subscription.remove();
305
- // };
306
- // }, [activeCallCid, microphone, isOutcomingCall, isIncomingCall]);
307
- };
@@ -1,39 +0,0 @@
1
- /**
2
- * Module to manage pending promise for audio session activation.
3
- * Used to wait for iOS CallKit's didActivateAudioSession event after starting a call.
4
- */
5
-
6
- let pendingResolve: (() => void) | null = null;
7
- let pendingTimeout: ReturnType<typeof setTimeout> | null = null;
8
-
9
- const AUDIO_SESSION_TIMEOUT_MS = 5000;
10
-
11
- /**
12
- * Creates a promise that resolves when the audio session is activated,
13
- * or after a timeout to prevent hanging indefinitely.
14
- * @returns Promise that resolves when audio session is activated or timeout occurs
15
- */
16
- export function waitForAudioSessionActivation(): Promise<void> {
17
- return new Promise((resolve) => {
18
- pendingResolve = resolve;
19
- pendingTimeout = setTimeout(() => {
20
- // Resolve on timeout to prevent hanging
21
- resolvePendingAudioSession();
22
- }, AUDIO_SESSION_TIMEOUT_MS);
23
- });
24
- }
25
-
26
- /**
27
- * Resolves the pending audio session activation promise.
28
- * Called when the didActivateAudioSession event fires or on timeout.
29
- */
30
- export function resolvePendingAudioSession(): void {
31
- if (pendingTimeout) {
32
- clearTimeout(pendingTimeout);
33
- pendingTimeout = null;
34
- }
35
- if (pendingResolve) {
36
- pendingResolve();
37
- pendingResolve = null;
38
- }
39
- }
@@ -1,108 +0,0 @@
1
- /***
2
- * Internal utils for callingx library usage from video-client.
3
- * See @./registerSDKGlobals.ts for more usage details.
4
- */
5
- import { Platform } from 'react-native';
6
- import { getCallingxLibIfAvailable } from '../push/libs/callingx';
7
- import {
8
- Call,
9
- MemberResponse,
10
- StreamVideoParticipant,
11
- videoLoggerSystem,
12
- } from '@stream-io/video-client';
13
- import { waitForAudioSessionActivation } from './audioSessionPromise';
14
-
15
- const CallingxModule = getCallingxLibIfAvailable();
16
-
17
- /**
18
- * Gets the call display name. To be used for display in native call screen.
19
- */
20
- export function getCallDisplayName(
21
- callMembers: MemberResponse[] | undefined,
22
- participants: StreamVideoParticipant[] | undefined,
23
- currentUserId: string | undefined,
24
- ) {
25
- if (!callMembers || !participants || !currentUserId) {
26
- return 'Call';
27
- }
28
-
29
- let names: string[] = [];
30
-
31
- if (callMembers.length > 0) {
32
- // for ringing calls, members array contains all call members from the very early state and participants array is empty in the beginning
33
- names = callMembers
34
- .filter((member) => member.user.id !== currentUserId)
35
- .map((member) => member.user.name)
36
- .filter((name): name is string => name !== undefined);
37
- } else if (participants.length > 0) {
38
- // for non-ringing calls, members array is empty and we rely on participants array there
39
- names = participants
40
- .filter((participant) => participant.userId !== currentUserId)
41
- .map((participant) => participant.name)
42
- .filter(Boolean);
43
- }
44
-
45
- // if no names are found, we use the name of the current user
46
- if (names.length === 0) {
47
- names = [
48
- participants.find((participant) => participant.userId === currentUserId)
49
- ?.name ?? 'Call',
50
- ];
51
- }
52
-
53
- return names.sort().join(', ');
54
- }
55
-
56
- /**
57
- * Starts the call in the callingx library.
58
- * Must be called for all outgoing calls
59
- * and optionally for non-ringing calls when ongoing calls are enabled.
60
- */
61
- export async function startCallingxCall(call: Call) {
62
- if (!CallingxModule || CallingxModule.isCallRegistered(call.cid)) {
63
- return;
64
- }
65
- const isOutcomingCall = call.ringing && call.isCreatedByMe;
66
- if (
67
- isOutcomingCall ||
68
- (!call.ringing && CallingxModule.isOngoingCallsEnabled)
69
- ) {
70
- const callDisplayName = getCallDisplayName(
71
- call.state.members,
72
- call.state.participants,
73
- call.currentUserId,
74
- );
75
-
76
- try {
77
- await CallingxModule.startCall(
78
- call.cid, // unique id for call
79
- call.id, // phone number for display in dialer (we use call id as phone number)
80
- callDisplayName, // display name for display in call screen
81
- call.state.settings?.video?.enabled ?? false, // is video call?
82
- );
83
-
84
- // Wait for audio session activation on iOS only
85
- if (Platform.OS === 'ios') {
86
- await waitForAudioSessionActivation();
87
- }
88
- } catch (error) {
89
- videoLoggerSystem
90
- .getLogger('startCallingxCall')
91
- .error(`Error starting call in callingx: ${call.cid}`, error);
92
- }
93
- }
94
- }
95
-
96
- export async function endCallingxCall(call: Call) {
97
- if (!CallingxModule || !CallingxModule.isCallRegistered(call.cid)) {
98
- return;
99
- }
100
-
101
- try {
102
- await CallingxModule.endCallWithReason(call.cid, 'local');
103
- } catch (error) {
104
- videoLoggerSystem
105
- .getLogger('endCallingxCall')
106
- .error(`Error ending call in callingx: ${call.cid}`, error);
107
- }
108
- }