@stream-io/video-react-native-sdk 1.28.3 → 1.29.0-beta.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 (240) hide show
  1. package/android/src/main/AndroidManifest.xml +8 -1
  2. package/android/src/main/AndroidManifestNew.xml +11 -0
  3. package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +42 -5
  4. package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +70 -6
  5. package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +6 -4
  6. package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +83 -0
  7. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +134 -0
  8. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js +3 -1
  9. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  10. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js +5 -2
  11. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  12. package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js +6 -3
  13. package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
  14. package/dist/commonjs/components/Participant/FloatingParticipantView/index.js +3 -1
  15. package/dist/commonjs/components/Participant/FloatingParticipantView/index.js.map +1 -1
  16. package/dist/commonjs/components/Participant/ParticipantView/ParticipantView.js +3 -1
  17. package/dist/commonjs/components/Participant/ParticipantView/ParticipantView.js.map +1 -1
  18. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/index.js +3 -2
  19. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/index.js.map +1 -1
  20. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +216 -0
  21. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  22. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  23. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  24. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +64 -97
  25. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  26. package/dist/commonjs/index.js +1 -0
  27. package/dist/commonjs/index.js.map +1 -1
  28. package/dist/commonjs/modules/call-manager/CallManager.js +26 -0
  29. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  30. package/dist/commonjs/providers/StreamCall/index.js +6 -6
  31. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  32. package/dist/commonjs/utils/StreamVideoRN/index.js +33 -21
  33. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  34. package/dist/commonjs/utils/internal/audioSessionPromise.js +46 -0
  35. package/dist/commonjs/utils/internal/audioSessionPromise.js.map +1 -0
  36. package/dist/commonjs/utils/internal/callingx.js +84 -0
  37. package/dist/commonjs/utils/internal/callingx.js.map +1 -0
  38. package/dist/commonjs/utils/internal/registerSDKGlobals.js +52 -3
  39. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  40. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +48 -0
  41. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +1 -0
  42. package/dist/commonjs/utils/push/android.js +145 -200
  43. package/dist/commonjs/utils/push/android.js.map +1 -1
  44. package/dist/commonjs/utils/push/internal/ios.js +16 -34
  45. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  46. package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -20
  47. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  48. package/dist/commonjs/utils/push/internal/utils.js +17 -1
  49. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  50. package/dist/commonjs/utils/push/ios.js.map +1 -1
  51. package/dist/commonjs/utils/push/libs/callingx.js +75 -0
  52. package/dist/commonjs/utils/push/libs/callingx.js.map +1 -0
  53. package/dist/commonjs/utils/push/libs/index.js +8 -19
  54. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  55. package/dist/commonjs/utils/push/libs/notifee/index.js +0 -19
  56. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  57. package/dist/commonjs/utils/push/setupCallingExpEvents.js +97 -0
  58. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -0
  59. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +7 -6
  60. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  61. package/dist/commonjs/version.js +1 -1
  62. package/dist/commonjs/version.js.map +1 -1
  63. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js +3 -1
  64. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  65. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js +5 -2
  66. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  67. package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js +6 -3
  68. package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
  69. package/dist/module/components/Participant/FloatingParticipantView/index.js +3 -1
  70. package/dist/module/components/Participant/FloatingParticipantView/index.js.map +1 -1
  71. package/dist/module/components/Participant/ParticipantView/ParticipantView.js +3 -1
  72. package/dist/module/components/Participant/ParticipantView/ParticipantView.js.map +1 -1
  73. package/dist/module/components/Participant/ParticipantView/VideoRenderer/index.js +3 -2
  74. package/dist/module/components/Participant/ParticipantView/VideoRenderer/index.js.map +1 -1
  75. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +209 -0
  76. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  77. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  78. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  79. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +66 -99
  80. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  81. package/dist/module/index.js +1 -0
  82. package/dist/module/index.js.map +1 -1
  83. package/dist/module/modules/call-manager/CallManager.js +26 -0
  84. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  85. package/dist/module/providers/StreamCall/index.js +6 -6
  86. package/dist/module/providers/StreamCall/index.js.map +1 -1
  87. package/dist/module/utils/StreamVideoRN/index.js +33 -21
  88. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  89. package/dist/module/utils/internal/audioSessionPromise.js +39 -0
  90. package/dist/module/utils/internal/audioSessionPromise.js.map +1 -0
  91. package/dist/module/utils/internal/callingx.js +75 -0
  92. package/dist/module/utils/internal/callingx.js.map +1 -0
  93. package/dist/module/utils/internal/registerSDKGlobals.js +53 -4
  94. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  95. package/dist/module/utils/keepCallAliveHeadlessTask.js +42 -0
  96. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +1 -0
  97. package/dist/module/utils/push/android.js +147 -202
  98. package/dist/module/utils/push/android.js.map +1 -1
  99. package/dist/module/utils/push/internal/ios.js +16 -34
  100. package/dist/module/utils/push/internal/ios.js.map +1 -1
  101. package/dist/module/utils/push/internal/rxSubjects.js +0 -19
  102. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  103. package/dist/module/utils/push/internal/utils.js +14 -0
  104. package/dist/module/utils/push/internal/utils.js.map +1 -1
  105. package/dist/module/utils/push/ios.js.map +1 -1
  106. package/dist/module/utils/push/libs/callingx.js +67 -0
  107. package/dist/module/utils/push/libs/callingx.js.map +1 -0
  108. package/dist/module/utils/push/libs/index.js +1 -2
  109. package/dist/module/utils/push/libs/index.js.map +1 -1
  110. package/dist/module/utils/push/libs/notifee/index.js +0 -18
  111. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  112. package/dist/module/utils/push/setupCallingExpEvents.js +91 -0
  113. package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -0
  114. package/dist/module/utils/push/setupIosVoipPushEvents.js +7 -6
  115. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  116. package/dist/module/version.js +1 -1
  117. package/dist/module/version.js.map +1 -1
  118. package/dist/typescript/components/Call/CallLayout/CallParticipantsGrid.d.ts +2 -2
  119. package/dist/typescript/components/Call/CallLayout/CallParticipantsGrid.d.ts.map +1 -1
  120. package/dist/typescript/components/Call/CallLayout/CallParticipantsSpotlight.d.ts +2 -2
  121. package/dist/typescript/components/Call/CallLayout/CallParticipantsSpotlight.d.ts.map +1 -1
  122. package/dist/typescript/components/Call/CallParticipantsList/CallParticipantsList.d.ts +6 -1
  123. package/dist/typescript/components/Call/CallParticipantsList/CallParticipantsList.d.ts.map +1 -1
  124. package/dist/typescript/components/Participant/FloatingParticipantView/index.d.ts +2 -2
  125. package/dist/typescript/components/Participant/FloatingParticipantView/index.d.ts.map +1 -1
  126. package/dist/typescript/components/Participant/ParticipantView/ParticipantView.d.ts +6 -1
  127. package/dist/typescript/components/Participant/ParticipantView/ParticipantView.d.ts.map +1 -1
  128. package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/index.d.ts +2 -2
  129. package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/index.d.ts.map +1 -1
  130. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +5 -0
  131. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -0
  132. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  133. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  134. package/dist/typescript/index.d.ts +1 -0
  135. package/dist/typescript/index.d.ts.map +1 -1
  136. package/dist/typescript/modules/call-manager/CallManager.d.ts +5 -0
  137. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  138. package/dist/typescript/utils/StreamVideoRN/index.d.ts +20 -2
  139. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  140. package/dist/typescript/utils/StreamVideoRN/types.d.ts +54 -29
  141. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  142. package/dist/typescript/utils/internal/audioSessionPromise.d.ts +16 -0
  143. package/dist/typescript/utils/internal/audioSessionPromise.d.ts.map +1 -0
  144. package/dist/typescript/utils/internal/callingx.d.ts +13 -0
  145. package/dist/typescript/utils/internal/callingx.d.ts.map +1 -0
  146. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  147. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +10 -0
  148. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +1 -0
  149. package/dist/typescript/utils/push/android.d.ts +1 -2
  150. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  151. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  152. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -12
  153. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  154. package/dist/typescript/utils/push/internal/utils.d.ts +4 -0
  155. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  156. package/dist/typescript/utils/push/ios.d.ts +1 -2
  157. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  158. package/dist/typescript/utils/push/libs/callingx.d.ts +9 -0
  159. package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -0
  160. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts +16 -2
  161. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
  162. package/dist/typescript/utils/push/libs/index.d.ts +1 -2
  163. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  164. package/dist/typescript/utils/push/libs/notifee/index.d.ts +0 -1
  165. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  166. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +8 -0
  167. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -0
  168. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  169. package/dist/typescript/version.d.ts +1 -1
  170. package/dist/typescript/version.d.ts.map +1 -1
  171. package/expo-config-plugin/dist/withAndroidManifest.js +1 -33
  172. package/expo-config-plugin/dist/withAndroidPermissions.js +2 -7
  173. package/expo-config-plugin/dist/withAppDelegate.js +19 -197
  174. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  175. package/expo-config-plugin/dist/withiOSInfoPlist.js +2 -3
  176. package/ios/StreamInCallManager.m +2 -0
  177. package/ios/StreamInCallManager.swift +20 -5
  178. package/ios/StreamVideoReactNative.h +7 -4
  179. package/ios/StreamVideoReactNative.m +191 -82
  180. package/package.json +10 -15
  181. package/src/components/Call/CallLayout/CallParticipantsGrid.tsx +3 -1
  182. package/src/components/Call/CallLayout/CallParticipantsSpotlight.tsx +4 -1
  183. package/src/components/Call/CallParticipantsList/CallParticipantsList.tsx +8 -0
  184. package/src/components/Participant/FloatingParticipantView/index.tsx +3 -1
  185. package/src/components/Participant/ParticipantView/ParticipantView.tsx +7 -0
  186. package/src/components/Participant/ParticipantView/VideoRenderer/index.tsx +7 -2
  187. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +307 -0
  188. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +21 -34
  189. package/src/hooks/useAndroidKeepCallAliveEffect.ts +94 -120
  190. package/src/index.ts +1 -0
  191. package/src/modules/call-manager/CallManager.ts +36 -0
  192. package/src/modules/call-manager/native-module.d.ts +7 -0
  193. package/src/providers/StreamCall/index.tsx +6 -6
  194. package/src/utils/StreamVideoRN/index.ts +40 -30
  195. package/src/utils/StreamVideoRN/types.ts +56 -29
  196. package/src/utils/internal/audioSessionPromise.ts +39 -0
  197. package/src/utils/internal/callingx.ts +108 -0
  198. package/src/utils/internal/registerSDKGlobals.ts +47 -4
  199. package/src/utils/keepCallAliveHeadlessTask.ts +54 -0
  200. package/src/utils/push/android.ts +223 -308
  201. package/src/utils/push/internal/ios.ts +25 -46
  202. package/src/utils/push/internal/rxSubjects.ts +0 -29
  203. package/src/utils/push/internal/utils.ts +25 -0
  204. package/src/utils/push/ios.ts +1 -6
  205. package/src/utils/push/libs/callingx.ts +90 -0
  206. package/src/utils/push/libs/index.ts +1 -2
  207. package/src/utils/push/libs/notifee/index.ts +0 -27
  208. package/src/utils/push/setupCallingExpEvents.ts +117 -0
  209. package/src/utils/push/setupIosVoipPushEvents.ts +11 -7
  210. package/src/version.ts +1 -1
  211. package/CHANGELOG.md +0 -3103
  212. package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +0 -95
  213. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -160
  214. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  215. package/dist/commonjs/utils/push/libs/callkeep.js +0 -17
  216. package/dist/commonjs/utils/push/libs/callkeep.js.map +0 -1
  217. package/dist/commonjs/utils/push/libs/voipPushNotification.js +0 -17
  218. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +0 -1
  219. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +0 -205
  220. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +0 -1
  221. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -153
  222. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  223. package/dist/module/utils/push/libs/callkeep.js +0 -11
  224. package/dist/module/utils/push/libs/callkeep.js.map +0 -1
  225. package/dist/module/utils/push/libs/voipPushNotification.js +0 -11
  226. package/dist/module/utils/push/libs/voipPushNotification.js.map +0 -1
  227. package/dist/module/utils/push/setupIosCallKeepEvents.js +0 -199
  228. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +0 -1
  229. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +0 -5
  230. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +0 -1
  231. package/dist/typescript/utils/push/libs/callkeep.d.ts +0 -3
  232. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +0 -1
  233. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +0 -3
  234. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +0 -1
  235. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +0 -6
  236. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +0 -1
  237. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +0 -235
  238. package/src/utils/push/libs/callkeep.ts +0 -16
  239. package/src/utils/push/libs/voipPushNotification.ts +0 -17
  240. package/src/utils/push/setupIosCallKeepEvents.ts +0 -252
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolvePendingAudioSession = resolvePendingAudioSession;
7
+ exports.waitForAudioSessionActivation = waitForAudioSessionActivation;
8
+ /**
9
+ * Module to manage pending promise for audio session activation.
10
+ * Used to wait for iOS CallKit's didActivateAudioSession event after starting a call.
11
+ */
12
+
13
+ let pendingResolve = null;
14
+ let pendingTimeout = null;
15
+ const AUDIO_SESSION_TIMEOUT_MS = 5000;
16
+
17
+ /**
18
+ * Creates a promise that resolves when the audio session is activated,
19
+ * or after a timeout to prevent hanging indefinitely.
20
+ * @returns Promise that resolves when audio session is activated or timeout occurs
21
+ */
22
+ function waitForAudioSessionActivation() {
23
+ return new Promise(resolve => {
24
+ pendingResolve = resolve;
25
+ pendingTimeout = setTimeout(() => {
26
+ // Resolve on timeout to prevent hanging
27
+ resolvePendingAudioSession();
28
+ }, AUDIO_SESSION_TIMEOUT_MS);
29
+ });
30
+ }
31
+
32
+ /**
33
+ * Resolves the pending audio session activation promise.
34
+ * Called when the didActivateAudioSession event fires or on timeout.
35
+ */
36
+ function resolvePendingAudioSession() {
37
+ if (pendingTimeout) {
38
+ clearTimeout(pendingTimeout);
39
+ pendingTimeout = null;
40
+ }
41
+ if (pendingResolve) {
42
+ pendingResolve();
43
+ pendingResolve = null;
44
+ }
45
+ }
46
+ //# sourceMappingURL=audioSessionPromise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["pendingResolve","pendingTimeout","AUDIO_SESSION_TIMEOUT_MS","waitForAudioSessionActivation","Promise","resolve","setTimeout","resolvePendingAudioSession","clearTimeout"],"sourceRoot":"../../../../src","sources":["utils/internal/audioSessionPromise.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;;AAEA,IAAIA,cAAmC,GAAG,IAAI;AAC9C,IAAIC,cAAoD,GAAG,IAAI;AAE/D,MAAMC,wBAAwB,GAAG,IAAI;;AAErC;AACA;AACA;AACA;AACA;AACO,SAASC,6BAA6BA,CAAA,EAAkB;EAC7D,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9BL,cAAc,GAAGK,OAAO;IACxBJ,cAAc,GAAGK,UAAU,CAAC,MAAM;MAChC;MACAC,0BAA0B,CAAC,CAAC;IAC9B,CAAC,EAAEL,wBAAwB,CAAC;EAC9B,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACO,SAASK,0BAA0BA,CAAA,EAAS;EACjD,IAAIN,cAAc,EAAE;IAClBO,YAAY,CAACP,cAAc,CAAC;IAC5BA,cAAc,GAAG,IAAI;EACvB;EACA,IAAID,cAAc,EAAE;IAClBA,cAAc,CAAC,CAAC;IAChBA,cAAc,GAAG,IAAI;EACvB;AACF","ignoreList":[]}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.endCallingxCall = endCallingxCall;
7
+ exports.getCallDisplayName = getCallDisplayName;
8
+ exports.startCallingxCall = startCallingxCall;
9
+ var _reactNative = require("react-native");
10
+ var _callingx = require("../push/libs/callingx");
11
+ var _videoClient = require("@stream-io/video-client");
12
+ var _audioSessionPromise = require("./audioSessionPromise");
13
+ /***
14
+ * Internal utils for callingx library usage from video-client.
15
+ * See @./registerSDKGlobals.ts for more usage details.
16
+ */
17
+
18
+ const CallingxModule = (0, _callingx.getCallingxLibIfAvailable)();
19
+
20
+ /**
21
+ * Gets the call display name. To be used for display in native call screen.
22
+ */
23
+ function getCallDisplayName(callMembers, participants, currentUserId) {
24
+ if (!callMembers || !participants || !currentUserId) {
25
+ return 'Call';
26
+ }
27
+ let names = [];
28
+ if (callMembers.length > 0) {
29
+ // for ringing calls, members array contains all call members from the very early state and participants array is empty in the beginning
30
+ names = callMembers.filter(member => member.user.id !== currentUserId).map(member => member.user.name).filter(name => name !== undefined);
31
+ } else if (participants.length > 0) {
32
+ // for non-ringing calls, members array is empty and we rely on participants array there
33
+ names = participants.filter(participant => participant.userId !== currentUserId).map(participant => participant.name).filter(Boolean);
34
+ }
35
+
36
+ // if no names are found, we use the name of the current user
37
+ if (names.length === 0) {
38
+ names = [participants.find(participant => participant.userId === currentUserId)?.name ?? 'Call'];
39
+ }
40
+ return names.sort().join(', ');
41
+ }
42
+
43
+ /**
44
+ * Starts the call in the callingx library.
45
+ * Must be called for all outgoing calls
46
+ * and optionally for non-ringing calls when ongoing calls are enabled.
47
+ */
48
+ async function startCallingxCall(call) {
49
+ if (!CallingxModule || CallingxModule.isCallRegistered(call.cid)) {
50
+ return;
51
+ }
52
+ const isOutcomingCall = call.ringing && call.isCreatedByMe;
53
+ if (isOutcomingCall || !call.ringing && CallingxModule.isOngoingCallsEnabled) {
54
+ const callDisplayName = getCallDisplayName(call.state.members, call.state.participants, call.currentUserId);
55
+ try {
56
+ await CallingxModule.startCall(call.cid,
57
+ // unique id for call
58
+ call.id,
59
+ // phone number for display in dialer (we use call id as phone number)
60
+ callDisplayName,
61
+ // display name for display in call screen
62
+ call.state.settings?.video?.enabled ?? false // is video call?
63
+ );
64
+
65
+ // Wait for audio session activation on iOS only
66
+ if (_reactNative.Platform.OS === 'ios') {
67
+ await (0, _audioSessionPromise.waitForAudioSessionActivation)();
68
+ }
69
+ } catch (error) {
70
+ _videoClient.videoLoggerSystem.getLogger('startCallingxCall').error(`Error starting call in callingx: ${call.cid}`, error);
71
+ }
72
+ }
73
+ }
74
+ async function endCallingxCall(call) {
75
+ if (!CallingxModule || !CallingxModule.isCallRegistered(call.cid)) {
76
+ return;
77
+ }
78
+ try {
79
+ await CallingxModule.endCallWithReason(call.cid, 'local');
80
+ } catch (error) {
81
+ _videoClient.videoLoggerSystem.getLogger('endCallingxCall').error(`Error ending call in callingx: ${call.cid}`, error);
82
+ }
83
+ }
84
+ //# sourceMappingURL=callingx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_callingx","_videoClient","_audioSessionPromise","CallingxModule","getCallingxLibIfAvailable","getCallDisplayName","callMembers","participants","currentUserId","names","length","filter","member","user","id","map","name","undefined","participant","userId","Boolean","find","sort","join","startCallingxCall","call","isCallRegistered","cid","isOutcomingCall","ringing","isCreatedByMe","isOngoingCallsEnabled","callDisplayName","state","members","startCall","settings","video","enabled","Platform","OS","waitForAudioSessionActivation","error","videoLoggerSystem","getLogger","endCallingxCall","endCallWithReason"],"sourceRoot":"../../../../src","sources":["utils/internal/callingx.ts"],"mappings":";;;;;;;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IAAAG,oBAAA,GAAAH,OAAA;AAZA;AACA;AACA;AACA;;AAWA,MAAMI,cAAc,GAAG,IAAAC,mCAAyB,EAAC,CAAC;;AAElD;AACA;AACA;AACO,SAASC,kBAAkBA,CAChCC,WAAyC,EACzCC,YAAkD,EAClDC,aAAiC,EACjC;EACA,IAAI,CAACF,WAAW,IAAI,CAACC,YAAY,IAAI,CAACC,aAAa,EAAE;IACnD,OAAO,MAAM;EACf;EAEA,IAAIC,KAAe,GAAG,EAAE;EAExB,IAAIH,WAAW,CAACI,MAAM,GAAG,CAAC,EAAE;IAC1B;IACAD,K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C;IAED,IAAI;MACF,MAAML,cAAc,CAACgC,SAAS,CAC5BV,IAAI,CAACE,GAAG;MAAE;MACVF,IAAI,CAACX,EAAE;MAAE;MACTkB,eAAe;MAAE;MACjBP,IAAI,CAACQ,KAAK,CAACG,QAAQ,EAAEC,KAAK,EAAEC,OAAO,IAAI,KAAK,CAAE;MAChD,CAAC;;MAED;MACA,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;QACzB,MAAM,IAAAC,kDAA6B,EAAC,CAAC;MACvC;IACF,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdC,8BAAiB,CACdC,SAAS,CAAC,mBAAmB,CAAC,CAC9BF,KAAK,CAAC,oCAAoCjB,IAAI,CAACE,GAAG,EAAE,EAAEe,KAAK,CAAC;IACjE;EACF;AACF;AAEO,eAAeG,eAAeA,CAACpB,IAAU,EAAE;EAChD,IAAI,CAACtB,cAAc,IAAI,CAACA,cAAc,CAACuB,gBAAgB,CAACD,IAAI,CAACE,GAAG,CAAC,EAAE;IACjE;EACF;EAEA,IAAI;IACF,MAAMxB,cAAc,CAAC2C,iBAAiB,CAACrB,IAAI,CAACE,GAAG,EAAE,OAAO,CAAC;EAC3D,CAAC,CAAC,OAAOe,KAAK,EAAE;IACdC,8BAAiB,CACdC,SAAS,CAAC,iBAAiB,CAAC,CAC5BF,KAAK,CAAC,kCAAkCjB,IAAI,CAACE,GAAG,EAAE,EAAEe,KAAK,CAAC;EAC/D;AACF","ignoreList":[]}
@@ -5,19 +5,68 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.registerSDKGlobals = registerSDKGlobals;
7
7
  var _reactNative = require("react-native");
8
+ var _callingx = require("../push/libs/callingx");
9
+ var _callingx2 = require("./callingx");
8
10
  const StreamInCallManagerNativeModule = _reactNative.NativeModules.StreamInCallManager;
11
+ const CallingxModule = (0, _callingx.getCallingxLibIfAvailable)();
12
+
13
+ /**
14
+ * Checks if StreamInCallManager should be bypassed because CallKit is handling
15
+ * the audio session via CallingX.
16
+ *
17
+ * On iOS, when CallingX is set up and has a registered call, the audio session
18
+ * is managed by CallKit through CallingxImpl.swift.
19
+ * In this case, StreamInCallManager should not run to avoid conflicting audio
20
+ * session configurations.
21
+ */
22
+ const shouldBypassForCallKit = ({
23
+ isRingingTypeCall
24
+ }) => {
25
+ if (_reactNative.Platform.OS !== 'ios') {
26
+ return false;
27
+ }
28
+ if (!CallingxModule) {
29
+ return false;
30
+ }
31
+ const bypass = CallingxModule.isSetup && (isRingingTypeCall || CallingxModule.isOngoingCallsEnabled);
32
+ return bypass;
33
+ };
9
34
  const streamRNVideoSDKGlobals = {
35
+ callingX: {
36
+ startCall: _callingx2.startCallingxCall,
37
+ endCall: _callingx2.endCallingxCall
38
+ },
10
39
  callManager: {
11
40
  setup: ({
12
- defaultDevice
41
+ defaultDevice,
42
+ isRingingTypeCall
13
43
  }) => {
44
+ if (shouldBypassForCallKit({
45
+ isRingingTypeCall
46
+ })) {
47
+ return;
48
+ }
14
49
  StreamInCallManagerNativeModule.setDefaultAudioDeviceEndpointType(defaultDevice);
15
50
  StreamInCallManagerNativeModule.setup();
16
51
  },
17
- start: () => {
52
+ start: ({
53
+ isRingingTypeCall
54
+ }) => {
55
+ if (shouldBypassForCallKit({
56
+ isRingingTypeCall
57
+ })) {
58
+ return;
59
+ }
18
60
  StreamInCallManagerNativeModule.start();
19
61
  },
20
- stop: () => {
62
+ stop: ({
63
+ isRingingTypeCall
64
+ }) => {
65
+ if (shouldBypassForCallKit({
66
+ isRingingTypeCall
67
+ })) {
68
+ return;
69
+ }
21
70
  StreamInCallManagerNativeModule.stop();
22
71
  }
23
72
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","StreamInCallManagerNativeModule","NativeModules","StreamInCallManager","streamRNVideoSDKGlobals","callManager","setup","defaultDevice","setDefaultAudioDeviceEndpointType","start","stop","registerSDKGlobals","global","streamRNVideoSDK"],"sourceRoot":"../../../../src","sources":["utils/internal/registerSDKGlobals.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,+BAA+B,GAAGC,0BAAa,CAACC,mBAAmB;AAEzE,MAAMC,uBAAgD,GAAG;EACvDC,WAAW,EAAE;IACXC,KAAK,EAAEA,CAAC;MAAEC;IAAc,CAAC,KAAK;MAC5BN,+BAA+B,CAACO,iCAAiC,CAC/DD,aACF,CAAC;MACDN,+BAA+B,CAACK,KAAK,CAAC,CAAC;IACzC,CAAC;IACDG,KAAK,EAAEA,CAAA,KAAM;MACXR,+BAA+B,CAACQ,KAAK,CAAC,CAAC;IACzC,CAAC;IACDC,IAAI,EAAEA,CAAA,KAAM;MACVT,+BAA+B,CAACS,IAAI,CAAC,CAAC;IACxC;EACF;AACF,CAAC;;AAED;AACA;AACA;AACO,SAASC,kBAAkBA,CAAA,EAAG;EACnC,IAAI,CAACC,MAAM,CAACC,gBAAgB,EAAE;IAC5BD,MAAM,CAACC,gBAAgB,GAAGT,uBAAuB;EACnD;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_callingx","_callingx2","StreamInCallManagerNativeModule","NativeModules","StreamInCallManager","CallingxModule","getCallingxLibIfAvailable","shouldBypassForCallKit","isRingingTypeCall","Platform","OS","bypass","isSetup","isOngoingCallsEnabled","streamRNVideoSDKGlobals","callingX","startCall","startCallingxCall","endCall","endCallingxCall","callManager","setup","defaultDevice","setDefaultAudioDeviceEndpointType","start","stop","registerSDKGlobals","global","streamRNVideoSDK"],"sourceRoot":"../../../../src","sources":["utils/internal/registerSDKGlobals.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,MAAMG,+BAA+B,GAAGC,0BAAa,CAACC,mBAAmB;AAEzE,MAAMC,cAAc,GAAG,IAAAC,mCAAyB,EAAC,CAAC;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM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perty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.keepCallAliveCallRef = exports.KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _videoClient = require("@stream-io/video-client");
9
+ var _StreamVideoRN = require("./StreamVideoRN");
10
+ const KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = exports.KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = 'StreamVideoKeepCallAlive';
11
+
12
+ /**
13
+ * The keep-alive headless task needs access to the active `Call` instance.
14
+ * The keep-alive hook will set this reference before starting the native service.
15
+ */
16
+ const keepCallAliveCallRef = exports.keepCallAliveCallRef = {
17
+ current: undefined
18
+ };
19
+ function registerKeepCallAliveHeadlessTaskOnce() {
20
+ if (_reactNative.Platform.OS !== 'android') return;
21
+ _reactNative.AppRegistry.registerHeadlessTask(KEEP_CALL_ALIVE_HEADLESS_TASK_NAME, () => async data => {
22
+ const logger = _videoClient.videoLoggerSystem.getLogger('KEEP_CALL_ALIVE_HEADLESS_TASK');
23
+ const callCid = data?.callCid;
24
+ const call = keepCallAliveCallRef.current;
25
+ if (!call) {
26
+ logger.warn('No active call instance available for keep-alive task; skipping.', {
27
+ callCid
28
+ });
29
+ return;
30
+ }
31
+ if (callCid && call.cid && call.cid !== callCid) {
32
+ logger.warn('Keep-alive task callCid does not match active call; skipping.', {
33
+ callCid,
34
+ activeCallCid: call.cid
35
+ });
36
+ return;
37
+ }
38
+ const config = _StreamVideoRN.StreamVideoRN.getConfig();
39
+ const taskToRun = config.foregroundService.android.taskToRun;
40
+ try {
41
+ await taskToRun(call);
42
+ } catch (e) {
43
+ logger.error('Keep-alive headless task failed', e);
44
+ }
45
+ });
46
+ }
47
+ registerKeepCallAliveHeadlessTaskOnce();
48
+ //# sourceMappingURL=keepCallAliveHeadlessTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_videoClient","_StreamVideoRN","KEEP_CALL_ALIVE_HEADLESS_TASK_NAME","exports","keepCallAliveCallRef","current","undefined","registerKeepCallAliveHeadlessTaskOnce","Platform","OS","AppRegistry","registerHeadlessTask","data","logger","videoLoggerSystem","getLogger","callCid","call","warn","cid","activeCallCid","config","StreamVideoRN","getConfig","taskToRun","foregroundService","android","e","error"],"sourceRoot":"../../../src","sources":["utils/keepCallAliveHeadlessTask.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEO,MAAMG,kCAAkC,GAAAC,OAAA,CAAAD,kCAAA,GAAG,0BAA0B;;AAE5E;AACA;AACA;AACA;AACO,MAAME,oBAAmD,GAAAD,OAAA,CAAAC,oBAAA,GAAG;EACjEC,OAAO,EAAEC;AACX,CAAC;AAED,SAASC,qCAAqCA,CAAA,EAAG;EAC/C,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;EAE/BC,wBAAW,CAACC,oBAAoB,CAC9BT,kCAAkC,EAClC,MAAM,MAAOU,IAAsC,IAAK;IACtD,MAAMC,MAAM,GAAGC,8BAAiB,CAACC,SAAS,CACxC,+BACF,CAAC;IACD,MAAMC,OAAO,GAAGJ,IAAI,EAAEI,OAAO;IAE7B,MAAMC,IAAI,GAAGb,oBAAoB,CAACC,OAAO;IACzC,IAAI,CAACY,IAAI,EAAE;MACTJ,MAAM,CAACK,IAAI,CACT,kEAAkE,EAClE;QAAEF;MAAQ,CACZ,CAAC;MACD;IACF;IACA,IAAIA,OAAO,IAAIC,IAAI,CAACE,GAAG,IAAIF,IAAI,CAACE,GAAG,KAAKH,OAAO,EAAE;MAC/CH,MAAM,CAACK,IAAI,CACT,+DAA+D,EAC/D;QAAEF,OAAO;QAAEI,aAAa,EAAEH,IAAI,CAACE;MAAI,CACrC,CAAC;MACD;IACF;IAEA,MAAME,MAAM,GAAGC,4BAAa,CAACC,SAAS,CAAC,CAAC;IACxC,MAAMC,SAAS,GAAGH,MAA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