@stream-io/video-react-native-sdk 1.30.0 → 1.30.1-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 (208) 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 +149 -0
  8. package/dist/commonjs/hooks/push/index.js +0 -2
  9. package/dist/commonjs/hooks/push/index.js.map +1 -1
  10. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +121 -0
  11. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  12. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  13. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  14. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +64 -97
  15. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  16. package/dist/commonjs/index.js +1 -0
  17. package/dist/commonjs/index.js.map +1 -1
  18. package/dist/commonjs/modules/call-manager/CallManager.js +26 -0
  19. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  20. package/dist/commonjs/providers/StreamCall/index.js +6 -6
  21. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  22. package/dist/commonjs/utils/StreamVideoRN/index.js +33 -21
  23. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  24. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +68 -0
  25. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  26. package/dist/commonjs/utils/internal/callingx/callingx.js +123 -0
  27. package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -0
  28. package/dist/commonjs/utils/internal/registerSDKGlobals.js +52 -3
  29. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  30. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +48 -0
  31. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +1 -0
  32. package/dist/commonjs/utils/push/android.js +135 -202
  33. package/dist/commonjs/utils/push/android.js.map +1 -1
  34. package/dist/commonjs/utils/push/internal/ios.js +17 -34
  35. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  36. package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -45
  37. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  38. package/dist/commonjs/utils/push/internal/utils.js +67 -52
  39. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  40. package/dist/commonjs/utils/push/ios.js.map +1 -1
  41. package/dist/commonjs/utils/push/libs/callingx.js +78 -0
  42. package/dist/commonjs/utils/push/libs/callingx.js.map +1 -0
  43. package/dist/commonjs/utils/push/libs/index.js +8 -19
  44. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  45. package/dist/commonjs/utils/push/libs/notifee/index.js +0 -19
  46. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  47. package/dist/commonjs/utils/push/setupCallingExpEvents.js +105 -0
  48. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -0
  49. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +7 -6
  50. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  51. package/dist/commonjs/version.js +1 -1
  52. package/dist/commonjs/version.js.map +1 -1
  53. package/dist/module/hooks/push/index.js +0 -2
  54. package/dist/module/hooks/push/index.js.map +1 -1
  55. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +114 -0
  56. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  57. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  58. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  59. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +66 -99
  60. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  61. package/dist/module/index.js +1 -0
  62. package/dist/module/index.js.map +1 -1
  63. package/dist/module/modules/call-manager/CallManager.js +26 -0
  64. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  65. package/dist/module/providers/StreamCall/index.js +6 -6
  66. package/dist/module/providers/StreamCall/index.js.map +1 -1
  67. package/dist/module/utils/StreamVideoRN/index.js +33 -21
  68. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  69. package/dist/module/utils/internal/callingx/audioSessionPromise.js +61 -0
  70. package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  71. package/dist/module/utils/internal/callingx/callingx.js +114 -0
  72. package/dist/module/utils/internal/callingx/callingx.js.map +1 -0
  73. package/dist/module/utils/internal/registerSDKGlobals.js +52 -3
  74. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  75. package/dist/module/utils/keepCallAliveHeadlessTask.js +42 -0
  76. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +1 -0
  77. package/dist/module/utils/push/android.js +137 -204
  78. package/dist/module/utils/push/android.js.map +1 -1
  79. package/dist/module/utils/push/internal/ios.js +17 -34
  80. package/dist/module/utils/push/internal/ios.js.map +1 -1
  81. package/dist/module/utils/push/internal/rxSubjects.js +0 -44
  82. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  83. package/dist/module/utils/push/internal/utils.js +63 -49
  84. package/dist/module/utils/push/internal/utils.js.map +1 -1
  85. package/dist/module/utils/push/ios.js.map +1 -1
  86. package/dist/module/utils/push/libs/callingx.js +70 -0
  87. package/dist/module/utils/push/libs/callingx.js.map +1 -0
  88. package/dist/module/utils/push/libs/index.js +1 -2
  89. package/dist/module/utils/push/libs/index.js.map +1 -1
  90. package/dist/module/utils/push/libs/notifee/index.js +0 -18
  91. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  92. package/dist/module/utils/push/setupCallingExpEvents.js +99 -0
  93. package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -0
  94. package/dist/module/utils/push/setupIosVoipPushEvents.js +7 -6
  95. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  96. package/dist/module/version.js +1 -1
  97. package/dist/module/version.js.map +1 -1
  98. package/dist/typescript/hooks/push/index.d.ts.map +1 -1
  99. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +5 -0
  100. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -0
  101. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  102. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  103. package/dist/typescript/index.d.ts +1 -0
  104. package/dist/typescript/index.d.ts.map +1 -1
  105. package/dist/typescript/modules/call-manager/CallManager.d.ts +5 -0
  106. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  107. package/dist/typescript/utils/StreamVideoRN/index.d.ts +20 -2
  108. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  109. package/dist/typescript/utils/StreamVideoRN/types.d.ts +63 -25
  110. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  111. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +16 -0
  112. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +1 -0
  113. package/dist/typescript/utils/internal/callingx/callingx.d.ts +17 -0
  114. package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -0
  115. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  116. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +10 -0
  117. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +1 -0
  118. package/dist/typescript/utils/push/android.d.ts +1 -2
  119. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  120. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  121. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -33
  122. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  123. package/dist/typescript/utils/push/internal/utils.d.ts +14 -8
  124. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  125. package/dist/typescript/utils/push/ios.d.ts +1 -2
  126. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  127. package/dist/typescript/utils/push/libs/callingx.d.ts +9 -0
  128. package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -0
  129. package/dist/typescript/utils/push/libs/index.d.ts +1 -2
  130. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  131. package/dist/typescript/utils/push/libs/notifee/index.d.ts +0 -1
  132. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  133. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +8 -0
  134. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -0
  135. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  136. package/dist/typescript/version.d.ts +1 -1
  137. package/dist/typescript/version.d.ts.map +1 -1
  138. package/expo-config-plugin/dist/withAndroidManifest.js +1 -33
  139. package/expo-config-plugin/dist/withAndroidPermissions.js +2 -7
  140. package/expo-config-plugin/dist/withAppDelegate.js +19 -197
  141. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  142. package/expo-config-plugin/dist/withiOSInfoPlist.js +2 -3
  143. package/ios/StreamInCallManager.m +2 -0
  144. package/ios/StreamInCallManager.swift +19 -7
  145. package/ios/StreamVideoReactNative.h +7 -4
  146. package/ios/StreamVideoReactNative.m +189 -82
  147. package/package.json +13 -18
  148. package/src/hooks/push/index.ts +0 -2
  149. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +147 -0
  150. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +21 -34
  151. package/src/hooks/useAndroidKeepCallAliveEffect.ts +94 -120
  152. package/src/index.ts +1 -0
  153. package/src/modules/call-manager/CallManager.ts +36 -0
  154. package/src/modules/call-manager/native-module.d.ts +7 -0
  155. package/src/providers/StreamCall/index.tsx +6 -6
  156. package/src/utils/StreamVideoRN/index.ts +40 -30
  157. package/src/utils/StreamVideoRN/types.ts +65 -25
  158. package/src/utils/internal/callingx/audioSessionPromise.ts +65 -0
  159. package/src/utils/internal/callingx/callingx.ts +165 -0
  160. package/src/utils/internal/registerSDKGlobals.ts +47 -4
  161. package/src/utils/keepCallAliveHeadlessTask.ts +54 -0
  162. package/src/utils/push/android.ts +196 -311
  163. package/src/utils/push/internal/ios.ts +28 -44
  164. package/src/utils/push/internal/rxSubjects.ts +0 -61
  165. package/src/utils/push/internal/utils.ts +104 -63
  166. package/src/utils/push/ios.ts +1 -6
  167. package/src/utils/push/libs/callingx.ts +93 -0
  168. package/src/utils/push/libs/index.ts +1 -2
  169. package/src/utils/push/libs/notifee/index.ts +0 -27
  170. package/src/utils/push/setupCallingExpEvents.ts +135 -0
  171. package/src/utils/push/setupIosVoipPushEvents.ts +11 -7
  172. package/src/version.ts +1 -1
  173. package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +0 -95
  174. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -160
  175. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  176. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +0 -67
  177. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +0 -1
  178. package/dist/commonjs/utils/push/libs/callkeep.js +0 -17
  179. package/dist/commonjs/utils/push/libs/callkeep.js.map +0 -1
  180. package/dist/commonjs/utils/push/libs/voipPushNotification.js +0 -17
  181. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +0 -1
  182. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +0 -205
  183. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +0 -1
  184. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -153
  185. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  186. package/dist/module/hooks/push/useProcessPushCallEffect.js +0 -60
  187. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +0 -1
  188. package/dist/module/utils/push/libs/callkeep.js +0 -11
  189. package/dist/module/utils/push/libs/callkeep.js.map +0 -1
  190. package/dist/module/utils/push/libs/voipPushNotification.js +0 -11
  191. package/dist/module/utils/push/libs/voipPushNotification.js.map +0 -1
  192. package/dist/module/utils/push/setupIosCallKeepEvents.js +0 -199
  193. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +0 -1
  194. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +0 -5
  195. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +0 -1
  196. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +0 -8
  197. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +0 -1
  198. package/dist/typescript/utils/push/libs/callkeep.d.ts +0 -3
  199. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +0 -1
  200. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +0 -3
  201. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +0 -1
  202. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +0 -6
  203. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +0 -1
  204. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +0 -235
  205. package/src/hooks/push/useProcessPushCallEffect.ts +0 -108
  206. package/src/utils/push/libs/callkeep.ts +0 -16
  207. package/src/utils/push/libs/voipPushNotification.ts +0 -17
  208. package/src/utils/push/setupIosCallKeepEvents.ts +0 -252
@@ -4,48 +4,4 @@ import { BehaviorSubject } from 'rxjs';
4
4
  * Note: it is should be subscribed only when a user has connected to the websocket of Stream
5
5
  */
6
6
  export const pushNonRingingCallData$ = new BehaviorSubject(undefined);
7
-
8
- /**
9
- * This rxjs subject is used to store the call cid of the accepted incoming call from push notification
10
- * Note: it is should be subscribed only when a user has connected to the websocket of Stream
11
- */
12
- export const pushAcceptedIncomingCallCId$ = new BehaviorSubject(undefined);
13
-
14
- /**
15
- * This rxjs subject is used to store the call cid of the tapped incoming call from push notification it is neither accepted nor rejected yet
16
- * Note: it should be subscribed only when a user has connected to the websocket of Stream
17
- */
18
- export const pushTappedIncomingCallCId$ = new BehaviorSubject(undefined);
19
-
20
- /**
21
- * This rxjs subject is used to store the call cid of the delivered incoming call from push notification it is neither accepted nor rejected yet
22
- * Used so that the call is navigated to when app is open from being killed
23
- * Note: it should be subscribed only when a user has connected to the websocket of Stream
24
- */
25
- export const pushAndroidBackgroundDeliveredIncomingCallCId$ = new BehaviorSubject(undefined);
26
-
27
- /**
28
- * This rxjs subject is used to store the call cid of the accepted incoming call from push notification
29
- * Note: it should be subscribed only when a user has connected to the websocket of Stream
30
- */
31
- export const pushRejectedIncomingCallCId$ = new BehaviorSubject(undefined);
32
-
33
- /**
34
- * This rxjs subject is used to store the call cid of the incoming call from ios voip pushkit notification
35
- */
36
- export const voipPushNotificationCallCId$ = new BehaviorSubject(undefined);
37
-
38
- /** The pair of cid of a call and its corresponding uuid created in the native side */
39
-
40
- /*
41
- * This rxjs subject should only used to store the CallkeepMap
42
- * for the incoming call when on foreground
43
- * or in other words, when we get didDisplayIncomingCall from callkeep lib
44
- */
45
- export const voipCallkeepCallOnForegroundMap$ = new BehaviorSubject(undefined);
46
-
47
- /*
48
- * This rxjs subject should only used to store the CallkeepMap when it was accepted in the native dialer
49
- */
50
- export const voipCallkeepAcceptedCallOnNativeDialerMap$ = new BehaviorSubject(undefined);
51
7
  //# sourceMappingURL=rxSubjects.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BehaviorSubject","pushNonRingingCallData$","undefined","pushAcceptedIncomingCallCId$","pushTappedIncomingCallCId$","pushAndroidBackgroundDeliveredIncomingCallCId$","pushRejectedIncomingCallCId$","voipPushNotificationCallCId$","voipCallkeepCallOnForegroundMap$","voipCallkeepAcceptedCallOnNativeDialerMap$"],"sourceRoot":"../../../../../src","sources":["utils/push/internal/rxSubjects.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,MAAM;AAGtC;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,IAAID,eAAe,CAExDE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,GAAG,IAAIH,eAAe,CAE7DE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAME,0BAA0B,GAAG,IAAIJ,eAAe,CAE3DE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,8CAA8C,GACzD,IAAIL,eAAe,CAAqBE,SAAS,CAAC;;AAEpD;AACA;AACA;AACA;AACA,OAAO,MAAMI,4BAA4B,GAAG,IAAIN,eAAe,CAE7DE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA,OAAO,MAAMK,4BAA4B,GAAG,IAAIP,eAAe,CAE7DE,SAAS,CAAC;;AAEZ;;AAMA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,gCAAgC,GAAG,IAAIR,eAAe,CAEjEE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA,OAAO,MAAMO,0CAA0C,GAAG,IAAIT,eAAe,CAE3EE,SAAS,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["BehaviorSubject","pushNonRingingCallData$","undefined"],"sourceRoot":"../../../../../src","sources":["utils/push/internal/rxSubjects.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,MAAM;AAGtC;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,IAAID,eAAe,CAExDE,SAAS,CAAC","ignoreList":[]}
@@ -1,47 +1,41 @@
1
1
  import { CallingState, videoLoggerSystem } from '@stream-io/video-client';
2
2
  import { onNewCallNotification } from '../../internal/newNotificationCallbacks';
3
3
  import { pushUnsubscriptionCallbacks } from './constants';
4
+ import { AppState } from 'react-native';
5
+ const logger = videoLoggerSystem.getLogger('callingx');
4
6
  /**
5
7
  * This function is used to check if the call should be ended based on the push notification
6
8
  * Useful for callkeep management to end the call if necessary (with reportEndCallWithUUID)
7
9
  */
8
10
  export const shouldCallBeEnded = (callFromPush, created_by_id, receiver_id) => {
9
- /* callkeep reasons for ending a call
10
- FAILED: 1,
11
- REMOTE_ENDED: 2,
12
- UNANSWERED: 3,
13
- ANSWERED_ELSEWHERE: 4,
14
- DECLINED_ELSEWHERE: 5,
15
- MISSED: 6
16
- */
17
11
  const callSession = callFromPush.state.session;
18
12
  const rejected_by = callSession?.rejected_by;
19
13
  const accepted_by = callSession?.accepted_by;
20
14
  let mustEndCall = false;
21
- let callkeepReason = 0;
15
+ let endCallReason = 'unknown';
22
16
  if (created_by_id && rejected_by) {
23
17
  if (rejected_by[created_by_id]) {
24
- // call was cancelled by the caller
18
+ // call was cancelled by the caller before the receiver could answer
25
19
  mustEndCall = true;
26
- callkeepReason = 2;
20
+ endCallReason = 'canceled';
27
21
  }
28
22
  } else if (receiver_id && rejected_by) {
29
23
  if (rejected_by[receiver_id]) {
30
24
  // call was rejected by the receiver in some other device
31
25
  mustEndCall = true;
32
- callkeepReason = 5;
26
+ endCallReason = 'rejected';
33
27
  }
34
28
  } else if (receiver_id && accepted_by) {
35
29
  if (accepted_by[receiver_id]) {
36
30
  // call was accepted by the receiver in some other device
37
31
  mustEndCall = true;
38
- callkeepReason = 4;
32
+ endCallReason = 'answeredElsewhere';
39
33
  }
40
34
  }
41
- videoLoggerSystem.getLogger('shouldCallBeEnded').debug(`callCid: ${callFromPush.cid} mustEndCall: ${mustEndCall} callkeepReason: ${callkeepReason}`);
35
+ videoLoggerSystem.getLogger('shouldCallBeEnded').debug(`callCid: ${callFromPush.cid} mustEndCall: ${mustEndCall} endCallReason: ${endCallReason}`);
42
36
  return {
43
37
  mustEndCall,
44
- callkeepReason
38
+ endCallReason
45
39
  };
46
40
  };
47
41
 
@@ -49,56 +43,63 @@ export const shouldCallBeEnded = (callFromPush, created_by_id, receiver_id) => {
49
43
  1. we need to create a new client and connect the user to decline the call
50
44
  2. this is because the app is in background state and we don't have a client to get the call and do an action
51
45
  */
52
- export const processCallFromPushInBackground = async (pushConfig, call_cid, action) => {
46
+ export const processCallFromPushInBackground = async (pushConfig, call_cid, action, onIOSActionCanBeFulfilled) => {
53
47
  let videoClient;
54
48
  try {
55
49
  videoClient = await pushConfig.createStreamVideoClient();
56
50
  if (!videoClient) {
57
- return;
51
+ throw new Error('createStreamVideoClient returned null');
58
52
  }
59
53
  } catch (e) {
60
- const logger = videoLoggerSystem.getLogger('processCallFromPushInBackground');
61
- logger.error('failed to create video client', e);
54
+ logger.error('processCallFromPushInBackground: failed to create video client', e);
55
+ onIOSActionCanBeFulfilled(true);
62
56
  return;
63
57
  }
64
- await processCallFromPush(videoClient, call_cid, action, pushConfig);
65
- };
66
-
67
- /**
68
- * This function is used process the call from push notifications due to incoming call
69
- * It does the following steps:
70
- * 1. Get the call from the client if present or create a new call
71
- * 2. Fetch the latest state of the call from the server if its not already in ringing state
72
- * 3. Join or leave the call based on the user's action.
73
- */
74
- export const processCallFromPush = async (client, call_cid, action, pushConfig) => {
75
58
  let callFromPush;
76
59
  try {
77
- callFromPush = await client.onRingingCall(call_cid);
60
+ callFromPush = await videoClient.onRingingCall(call_cid);
78
61
  } catch (e) {
79
- const logger = videoLoggerSystem.getLogger('processCallFromPush');
80
- logger.error('failed to fetch call from push notification', e);
62
+ logger.error('processCallFromPushInBackground: failed to fetch call from push notification', e);
63
+ onIOSActionCanBeFulfilled(true);
81
64
  return;
82
65
  }
83
- // note: when action was pressed or delivered, we dont need to do anything as the only thing is to do is to get the call which adds it to the client
84
- try {
85
- if (action === 'accept') {
86
- if (pushConfig.publishOptions) {
87
- callFromPush.updatePublishOptions(pushConfig.publishOptions);
88
- }
89
- videoLoggerSystem.getLogger('processCallFromPush').debug(`joining call from push notification with callCid: ${callFromPush.cid}`);
66
+ if (action === 'accept') {
67
+ if (pushConfig.publishOptions) {
68
+ callFromPush.updatePublishOptions(pushConfig.publishOptions);
69
+ }
70
+ logger.debug(`joining call from push notification with callCid: ${callFromPush.cid}`);
71
+ const callingState = callFromPush.state.callingState;
72
+ if (callingState !== CallingState.RINGING && callingState !== CallingState.IDLE) {
73
+ logger.debug(`skipping join call as it is not in ringing or idle state from push notification. callCid: ${callFromPush.cid}`);
74
+ onIOSActionCanBeFulfilled(true);
75
+ return;
76
+ }
77
+ try {
78
+ onIOSActionCanBeFulfilled(false);
90
79
  await callFromPush.join();
91
- } else if (action === 'decline') {
92
- const canReject = callFromPush.state.callingState === CallingState.RINGING;
93
- videoLoggerSystem.getLogger('processCallFromPush').debug(`declining call from push notification with callCid: ${callFromPush.cid} reject: ${canReject}`);
80
+ } catch (e) {
81
+ logger.warn('processCallFromPushInBackground: failed to join call from push notification', e);
82
+ }
83
+ } else if (action === 'decline') {
84
+ const alreadyLeft = callFromPush.state.callingState === CallingState.LEFT;
85
+ if (alreadyLeft) {
86
+ onIOSActionCanBeFulfilled(false);
87
+ return;
88
+ }
89
+ const canReject = callFromPush.state.callingState === CallingState.RINGING || callFromPush.state.callingState === CallingState.IDLE;
90
+ const isCurrentUserMember = callFromPush.state.members.some(member => member.user_id === callFromPush.currentUserId);
91
+ const reject = canReject && isCurrentUserMember;
92
+ logger.debug(`declining call from push notification with callCid: ${callFromPush.cid} reject: ${reject}`);
93
+ try {
94
94
  await callFromPush.leave({
95
- reject: canReject,
95
+ reject,
96
96
  reason: 'decline'
97
97
  });
98
+ onIOSActionCanBeFulfilled(false);
99
+ } catch (e) {
100
+ logger.warn('processCallFromPushInBackground: failed to decline call from push notification', e);
101
+ onIOSActionCanBeFulfilled(true);
98
102
  }
99
- } catch (e) {
100
- const logger = videoLoggerSystem.getLogger('processCallFromPush');
101
- logger.warn(`failed to process ${action} call from push notification`, e);
102
103
  }
103
104
  };
104
105
 
@@ -122,8 +123,8 @@ export const processNonIncomingCallFromPush = async (client, call_cid, nonRingin
122
123
  await callFromPush.get();
123
124
  }
124
125
  } catch (e) {
125
- const logger = videoLoggerSystem.getLogger('processNonIncomingCallFromPush');
126
- logger.error('failed to fetch call from push notification', e);
126
+ const nonRingingCallLogger = videoLoggerSystem.getLogger('processNonIncomingCallFromPush');
127
+ nonRingingCallLogger.error('failed to fetch call from push notification', e);
127
128
  return;
128
129
  }
129
130
  onNewCallNotification(callFromPush, nonRingingNotificationType);
@@ -148,4 +149,17 @@ export const clearPushWSEventSubscriptions = call_cid => {
148
149
  export const canAddPushWSSubscriptionsRef = {
149
150
  current: true
150
151
  };
152
+ export const canListenToWS = () => canAddPushWSSubscriptionsRef.current && AppState.currentState !== 'active';
153
+ export const shouldCallBeClosed = (call, pushData) => {
154
+ const created_by_id = pushData?.created_by_id;
155
+ const receiver_id = pushData?.receiver_id;
156
+ const {
157
+ mustEndCall,
158
+ endCallReason
159
+ } = shouldCallBeEnded(call, created_by_id, receiver_id);
160
+ return {
161
+ mustEndCall,
162
+ endCallReason
163
+ };
164
+ };
151
165
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CallingState","videoLoggerSystem","onNewCallNotification","pushUnsubscriptionCallbacks","shouldCallBeEnded","callFromPush","created_by_id","receiver_id","callSession","state","session","rejected_by","accepted_by","mustEndCall","callkeepReason","getLogger","debug","cid","processCallFromPushInBackground","pushConfig","call_cid","action","videoClient","createStreamVideoClient","e","logger","error","processCallFromPush","client","onRingingCall","publishOptions","updatePublishOptions","join","canReject","callingState","RINGING","leave","reject","reason","warn","processNonIncomingCallFromPush","nonRingingNotificationType","_callFromPush","calls","find","c","callType","callId","split","call","get","clearPushWSEventSubscriptions","unsubscriptionCallbacks","forEach","cb","delete","canAddPushWSSubscriptionsRef","current"],"sourceRoot":"../../../../../src","sources":["utils/push/internal/utils.ts"],"mappings":"AAAA,SAEEA,YAAY,EAEZC,iBAAiB,QACZ,yBAAyB;AAKhC,SAASC,qBAAqB,QAAQ,yCAAyC;AAC/E,SAASC,2BAA2B,QAAQ,aAAa;AAMzD;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGA,CAC/BC,YAAkB,EAClBC,aAAiC,EACjCC,WAA+B,KAC5B;EACH;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,WAAW,GAAGH,YAAY,CAACI,KAAK,CAACC,OAAO;EAC9C,MAAMC,WAAW,GAAGH,WAAW,EAAEG,WAAW;EAC5C,MAAMC,WAAW,GAAGJ,WAAW,EAAEI,WAAW;EAC5C,IAAIC,WAAW,GAAG,KAAK;EACvB,IAAIC,cAAc,GAAG,CAAC;EACtB,IAAIR,aAAa,IAAIK,WAAW,EAAE;IAChC,IAAIA,WAAW,CAACL,aAAa,CAAC,EAAE;MAC9B;MACAO,WAAW,GAAG,IAAI;MAClBC,cAAc,GAAG,CAAC;IACpB;EACF,CAAC,MAAM,IAAIP,WAAW,IAAII,WAAW,EAAE;IACrC,IAAIA,WAAW,CAACJ,WAAW,CAAC,EAAE;MAC5B;MACAM,WAAW,GAAG,IAAI;MAClBC,cAAc,GAAG,CAAC;IACpB;EACF,CAAC,MAAM,IAAIP,WAAW,IAAIK,WAAW,EAAE;IACrC,IAAIA,WAAW,CAACL,WAAW,CAAC,EAAE;MAC5B;MACAM,WAAW,GAAG,IAAI;MAClBC,cAAc,GAAG,CAAC;IACpB;EACF;EACAb,iBAAiB,CACdc,SAAS,CAAC,mBAAmB,CAAC,CAC9BC,KAAK,CACJ,YAAYX,YAAY,CAACY,GAAG,iBAAiBJ,WAAW,oBAAoBC,cAAc,EAC5F,CAAC;EACH,OAAO;IAAED,WAAW;IAA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,MAAMC,MAAM,GAAGxB,iBAAiB,CAACc,SAAS,CACxC,gCACF,CAAC;IACDU,MAAM,CAACC,KAAK,CAAC,6CAA6C,EAAEF,CAAC,CAAC;IAC9D;EACF;EACAtB,qBAAqB,CAACG,YAAY,EAAEoC,0BAA0B,CAAC;AACjE,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMU,6BAA6B,GAAI/B,QAAgB,IAAK;EACjE,MAAMgC,uBAAuB,GAAGjD,2BAA2B,CAAC+C,GAAG,CAAC9B,QAAQ,CAAC;EACzE,IAAIgC,uBAAuB,EAAE;IAC3BA,uBAAuB,CAACC,OAAO,CAAEC,EAAE,IAAKA,EAAE,CAAC,CAAC,CAAC;IAC7CnD,2BAA2B,CAACoD,MAAM,CAACnC,QAAQ,CAAC;EAC9C;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMoC,4BAA0D,GAAG;EACxEC,OAAO,EAAE;AACX,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["CallingState","videoLoggerSystem","onNewCallNotification","pushUnsubscriptionCallbacks","AppState","logger","getLogger","shouldCallBeEnded","callFromPush","created_by_id","receiver_id","callSession","state","session","rejected_by","accepted_by","mustEndCall","endCallReason","debug","cid","processCallFromPushInBackground","pushConfig","call_cid","action","onIOSActionCanBeFulfilled","videoClient","createStreamVideoClient","Error","e","error","onRingingCall","publishOptions","updatePublishOptions","callingState","RINGING","IDLE","join","warn","alreadyLeft","LEFT","canReject","isCurrentUserMember","members","some","member","user_id","currentUserId","reject","leave","reason","processNonIncomingCallFromPush","client","nonRingingNotificationType","_callFromPush","calls","find","c","callType","callId","split","call","get","nonRingingCallLogger","clearPushWSEventSubscriptions","unsubscriptionCallbacks","forEach","cb","delete","canAddPushWSSubscriptionsRef","current","canListenToWS","currentState","shouldCallBeClosed","pushData"],"sourceRoot":"../../../../../src","sources":["utils/push/internal/utils.ts"],"mappings":"AAAA,SAEEA,YAAY,EAEZC,iBAAiB,QACZ,yBAAyB;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AE/D,WAAqB;EAEnD,MAAM;IAAEM,WAAW;IAAEC;EAAc,CAAC,GAAGV,iBAAiB,CACtDqD,IAAI,EACJnD,aAAa,EACbC,WACF,CAAC;EACD,OAAO;IAAEM,WAAW;IAAEC;EAAc,CAAC;AACvC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","pushNonRingingCallData$","getExpoNotificationsLib","getNotifeeLibThrowIfNotInstalledForPush","getPushNotificationIosLib","videoLoggerSystem","setPushLogoutCallback","StreamVideoRN","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","logger","getLogger","trace","next","undefined","oniOSExpoNotificationEvent","event","pushConfig","getConfig","push","trigger","request","payload","stream","JSON","stringify","oniOSNotifeeEvent","OS","detail","notifeeLib","EventType","PRESS","notification","data","result","debug","onTapNonRingingCallNotification","onPushNotificationiOSStreamVideoEvent","pushNotificationIosLib","getData","isClicked","userInteraction","finish","FetchResult","NoData","initIosNonVoipToken","client","setUnsubscribeListener","ios","pushProviderName","setDeviceToken","streamClient","_user","id","removeDevice","err","warn","push_provider_name","addDevice","then","catch","isExpo","expoNotificationsLib","getDevicePushTokenAsync","devicePushToken","subscription","addPushTokenListener","remove","addEventListener","removeEventListener"],"sourceRoot":"../../../../src","sources":["utils/push/ios.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAEEC,uBAAuB,EACvBC,uCAAuC,EACvCC,yBAAyB,QAEpB,QAAQ;AACf,SAA4BC,iBAAiB,QAAQ,yBAAyB;AAC9E,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,SAASC,aAAa,QAAQ,kBAAkB;AAKhD,IAAIC,YAAY,GAAG;EAAEC,KAAK,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;AAE5C,SAASC,0CAA0CA,CACjDC,aAAgC,EAChC;EACA,IACEA,aAAa,EAAEC,MAAM,K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,CAACyB,KAAK,CAAC,mCAAmC,CAAC;QACjD8B,YAAY,CAACE,MAAM,CAAC,CAAC;MACvB,CAAC,CAAC;IACJ;EACF,CAAC,MAAM;IACL,MAAM7B,sBAAsB,GAAGzC,yBAAyB,CAAC,CAAC;IAC1DyC,sBAAsB,CAAC8B,gBAAgB,CAAC,UAAU,EAAGlE,KAAK,IAAK;MAC7DQ,MAAM,CAACyB,KAAK,CACV,wEAAwE,EACxEjC,KACF,CAAC;MACDgD,cAAc,CAAChD,KAAK,CAAC;IACvB,CAAC,CAAC;IACF6C,sBAAsB,CAAC,MAAM;MAC3BrC,MAAM,CAACyB,KAAK,CAAC,wDAAwD,CAAC;MACtEG,sBAAsB,CAAC+B,mBAAmB,CAAC,UAAU,CAAC;IACxD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"names":["Platform","pushNonRingingCallData$","getExpoNotificationsLib","getNotifeeLibThrowIfNotInstalledForPush","getPushNotificationIosLib","videoLoggerSystem","setPushLogoutCallback","StreamVideoRN","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","logger","getLogger","trace","next","undefined","oniOSExpoNotificationEvent","event","pushConfig","getConfig","push","trigger","request","payload","stream","JSON","stringify","oniOSNotifeeEvent","OS","detail","notifeeLib","EventType","PRESS","notification","data","result","debug","onTapNonRingingCallNotification","onPushNotificationiOSStreamVideoEvent","pushNotificationIosLib","getData","isClicked","userInteraction","finish","FetchResult","NoData","initIosNonVoipToken","client","setUnsubscribeListener","ios","pushProviderName","setDeviceToken","streamClient","_user","id","removeDevice","err","warn","push_provider_name","addDevice","then","catch","isExpo","expoNotificationsLib","getDevicePushTokenAsync","devicePushToken","subscription","addPushTokenListener","remove","addEventListener","removeEventListener"],"sourceRoot":"../../../../src","sources":["utils/push/ios.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAEEC,uBAAuB,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QACDiB,cAAc,CAACc,eAAe,CAAC/B,IAAI,CAAC;MACtC,CAAC,CAAC;MACF,MAAMgC,YAAY,GAAGH,oBAAoB,CAACI,oBAAoB,CAC3DF,eAAe,IAAK;QACnBtD,MAAM,CAACyB,KAAK,CACV,8DAA8D,EAC9D6B,eAAe,CAAC/B,IAClB,CAAC;QACDiB,cAAc,CAACc,eAAe,CAAC/B,IAAI,CAAC;MACtC,CACF,CAAC;MACDc,sBAAsB,CAAC,MAAM;QAC3BrC,MAAM,CAACyB,KAAK,CAAC,mCAAmC,CAAC;QACjD8B,YAAY,CAACE,MAAM,CAAC,CAAC;MACvB,CAAC,CAAC;IACJ;EACF,CAAC,MAAM;IACL,MAAM7B,sBAAsB,GAAGzC,yBAAyB,CAAC,CAAC;IAC1DyC,sBAAsB,CAAC8B,gBAAgB,CAAC,UAAU,EAAGlE,KAAK,IAAK;MAC7DQ,MAAM,CAACyB,KAAK,CACV,wEAAwE,EACxEjC,KACF,CAAC;MACDgD,cAAc,CAAChD,KAAK,CAAC;IACvB,CAAC,CAAC;IACF6C,sBAAsB,CAAC,MAAM;MAC3BrC,MAAM,CAACyB,KAAK,CAAC,wDAAwD,CAAC;MACtEG,sBAAsB,CAAC+B,mBAAmB,CAAC,UAAU,CAAC;IACxD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -0,0 +1,70 @@
1
+ let callingx;
2
+ try {
3
+ callingx = require('@stream-io/react-native-callingx').CallingxModule;
4
+ } catch {}
5
+ export function getCallingxLib() {
6
+ if (!callingx) {
7
+ throw Error('react-native-callingx library is not installed.');
8
+ }
9
+ return callingx;
10
+ }
11
+ export function getCallingxLibIfAvailable() {
12
+ return callingx ?? undefined;
13
+ }
14
+ export function extractCallingExpOptions(config) {
15
+ const {
16
+ push: pushConfig,
17
+ foregroundService: foregroundServiceConfig
18
+ } = config;
19
+ const callingExpOptions = {};
20
+ if (pushConfig?.ios) {
21
+ const iosOptions = {};
22
+ if (pushConfig.ios.supportsVideo !== undefined) {
23
+ iosOptions.supportsVideo = pushConfig.ios.supportsVideo;
24
+ }
25
+ if (pushConfig.ios.sound !== undefined) {
26
+ iosOptions.sound = pushConfig.ios.sound;
27
+ }
28
+ if (pushConfig.ios.imageName !== undefined) {
29
+ iosOptions.imageName = pushConfig.ios.imageName;
30
+ }
31
+ if (pushConfig.ios.callsHistory !== undefined) {
32
+ iosOptions.callsHistory = pushConfig.ios.callsHistory;
33
+ }
34
+ if (pushConfig.ios.displayCallTimeout !== undefined) {
35
+ iosOptions.displayCallTimeout = pushConfig.ios.displayCallTimeout;
36
+ }
37
+ if (Object.keys(iosOptions).length > 0) {
38
+ callingExpOptions.ios = iosOptions;
39
+ }
40
+ }
41
+ const androidOptions = {};
42
+ if (pushConfig?.android) {
43
+ if (pushConfig.android.incomingChannel) {
44
+ androidOptions.incomingChannel = pushConfig.android.incomingChannel;
45
+ }
46
+ if (pushConfig.android.titleTransformer) {
47
+ androidOptions.titleTransformer = pushConfig.android.titleTransformer;
48
+ }
49
+ if (pushConfig.android.subtitleTransformer) {
50
+ androidOptions.subtitleTransformer = pushConfig.android.subtitleTransformer;
51
+ }
52
+ if (pushConfig.android.notificationTexts) {
53
+ androidOptions.notificationTexts = pushConfig.android.notificationTexts;
54
+ }
55
+ }
56
+ if (foregroundServiceConfig.android.channel) {
57
+ androidOptions.ongoingChannel = foregroundServiceConfig.android.channel;
58
+ }
59
+ if (Object.keys(androidOptions).length > 0) {
60
+ callingExpOptions.android = androidOptions;
61
+ }
62
+ if (pushConfig?.shouldRejectCallWhenBusy !== undefined) {
63
+ callingExpOptions.shouldRejectCallWhenBusy = pushConfig.shouldRejectCallWhenBusy;
64
+ }
65
+ if (pushConfig?.enableOngoingCalls !== undefined) {
66
+ callingExpOptions.enableOngoingCalls = pushConfig?.enableOngoingCalls;
67
+ }
68
+ return callingExpOptions;
69
+ }
70
+ //# sourceMappingURL=callingx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["callingx","require","CallingxModule","getCallingxLib","Error","getCallingxLibIfAvailable","undefined","extractCallingExpOptions","config","push","pushConfig","foregroundService","foregroundServiceConfig","callingExpOptions","ios","iosOptions","supportsVideo","sound","imageName","callsHistory","displayCallTimeout","Object","keys","length","androidOptions","android","incomingChannel","titleTransformer","subtitleTransformer","notificationTexts","channel","ongoingChannel","shouldRejectCallWhenBusy","enableOngoingCalls"],"sourceRoot":"../../../../../src","sources":["utils/push/libs/callingx.ts"],"mappings":"AAUA,IAAIA,QAAoC;AAExC,IAAI;EACFA,QAAQ,GAAGC,OAAO,CAAC,kCAAkC,CAAC,CAACC,cAAc;AACvE,CAAC,CAAC,MAAM,CAAC;AAET,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,IAAI,CAACH,QAAQ,EAAE;IACb,MAAMI,KAAK,CAAC,iDAAiD,CAAC;EAChE;EACA,OAAOJ,QAAQ;AACjB;AAEA,OAAO,SAASK,yBAAyBA,CAAA,EAAG;EAC1C,OAAOL,QAAQ,IAAIM,SAAS;AAC9B;AAEA,OAAO,SAASC,wBAAwBA,CACtCC,MAAyB,EACN;EACnB,MAAM;IAAEC,IAAI,EAAEC,UAAU;IAAEC,iBAAiB,EAAEC;EAAwB,CAAC,GACpEJ,MAAM;EACR,MAAMK,iBAAoC,GAAG,CAAC,CAAC;EAE/C,IAAIH,UAAU,EAAEI,GAAG,EAAE;IACnB,MAAMC,UAAoC,GAAG,CAAC,CAAC;IAC/C,IAAIL,UAAU,CAACI,GAAG,CAACE,aAAa,KAAKV,SAAS,EAAE;MAC9CS,UAAU,CAACC,aAAa,GAAGN,UAAU,CAACI,GAAG,CAACE,aAAa;IACzD;IACA,IAAIN,UAAU,CAACI,GAAG,CAACG,KAAK,KAAKX,SAAS,EAAE;MACtCS,UAAU,CAACE,KAAK,GAAGP,UAAU,CAACI,GAAG,CAACG,KAAK;IACzC;IACA,IAAIP,UAAU,CAACI,GAAG,CAACI,SAAS,KAAKZ,SAAS,EAAE;MAC1CS,UAAU,CAACG,SAAS,GA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1CV,iBAAiB,CAACY,OAAO,GAAGD,cAAc;EAC5C;EAEA,IAAId,UAAU,EAAEsB,wBAAwB,KAAK1B,SAAS,EAAE;IACtDO,iBAAiB,CAACmB,wBAAwB,GACxCtB,UAAU,CAACsB,wBAAwB;EACvC;EAEA,IAAItB,UAAU,EAAEuB,kBAAkB,KAAK3B,SAAS,EAAE;IAChDO,iBAAiB,CAACoB,kBAAkB,GAAGvB,UAAU,EAAEuB,kBAAkB;EACvE;EAEA,OAAOpB,iBAAiB;AAC1B","ignoreList":[]}
@@ -1,9 +1,8 @@
1
1
  export * from './expoNotifications';
2
2
  export * from './firebaseMessaging';
3
3
  export * from './iosPushNotification';
4
- export * from './voipPushNotification';
5
- export * from './callkeep';
6
4
  export * from './notifee';
5
+ export * from './callingx';
7
6
 
8
7
  /*
9
8
  NOTE: must keep each libs in different files
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["utils/push/libs/index.ts"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,wBAAwB;AACtC,cAAc,YAAY;AAC1B,cAAc,WAAW;;AAEzB;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["utils/push/libs/index.ts"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,WAAW;AACzB,cAAc,YAAY;;AAE1B;AACA;AACA;AACA","ignoreList":[]}
@@ -1,6 +1,4 @@
1
- import { PermissionsAndroid } from 'react-native';
2
1
  import { lib } from './lib';
3
- import { videoLoggerSystem } from '@stream-io/video-client';
4
2
  var AndroidForegroundServiceType = /*#__PURE__*/function (AndroidForegroundServiceType) {
5
3
  AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_CAMERA"] = 64] = "FOREGROUND_SERVICE_TYPE_CAMERA";
6
4
  AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE"] = 16] = "FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE";
@@ -27,24 +25,8 @@ export function getNotifeeLibThrowIfNotInstalledForPush() {
27
25
  return lib;
28
26
  }
29
27
  export function getNotifeeLibNoThrowForKeepCallAlive() {
30
- if (!lib) {
31
- const logger = videoLoggerSystem.getLogger('getNotifeeLibNoThrow');
32
- logger.info(`${'@notifee/react-native library not installed. It is required to keep call alive in the background for Android. '}${INSTALLATION_INSTRUCTION}`);
33
- }
34
28
  return lib;
35
29
  }
36
- export async function getKeepCallAliveForegroundServiceTypes() {
37
- const types = [AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK];
38
- const hasCameraPermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.CAMERA);
39
- if (hasCameraPermission) {
40
- types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_CAMERA);
41
- }
42
- const hasMicrophonePermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO);
43
- if (hasMicrophonePermission) {
44
- types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_MICROPHONE);
45
- }
46
- return types;
47
- }
48
30
  export function getIncomingCallForegroundServiceTypes() {
49
31
  const types = [AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE];
50
32
  return types;
@@ -1 +1 @@
1
- {"version":3,"names":["PermissionsAndroid","lib","videoLoggerSystem","AndroidForegroundServiceType","INSTALLATION_INSTRUCTION","getNotifeeLibThrowIfNotInstalledForPush","Error","getNotifeeLibNoThrowForKeepCallAlive","logger","getLogger","info","getKeepCallAliveForegroundServiceTypes","types","FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK","hasCameraPermission","check","PERMISSIONS","CAMERA","push","FOREGROUND_SERVICE_TYPE_CAMERA","hasMicrophonePermission","RECORD_AUDIO","FOREGROUND_SERVICE_TYPE_MICROPHONE","getIncomingCallForegroundServiceTypes","FOREGROUND_SERVICE_TYPE_SHORT_SERVICE"],"sourceRoot":"../../../../../../src","sources":["utils/push/libs/notifee/index.ts"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,cAAc;AACjD,SAASC,GAAG,QAAmB,OAAO;AACtC,SAASC,iBAAiB,QAAQ,yBAAyB;AAAC,IAIvDC,4BAA4B,0BAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAAA,OAA5BA,4BAA4B;AAAA,EAA5BA,4BAA4B;AAkBjC,MAAMC,wBAAwB,GAC5B,6FAA6F;AAE/F,OAAO,SAASC,uCAAuCA,CAAA,EAAG;EACxD,IAAI,CAACJ,GAAG,EAAE;IACR,MAAMK,KAAK,CACT,8FAA8F,GAC5FF,wBACJ,CAAC;EACH;EACA,OAAOH,GAAG;AACZ;AAEA,OAAO,SAASM,oCAAoCA,CAAA,EAAG;EACrD,IAAI,CAACN,GAAG,EAAE;IACR,MAAMO,MAAM,GAAGN,iBAAiB,CAACO,SAAS,CAAC,sBAAsB,CAAC;IAClED,MAAM,CAACE,IAAI,CACT,GAAG,gHAAgH,GAAGN,wBAAwB,EAChJ,CAAC;EACH;EACA,OAAOH,GAAG;AACZ;AAEA,OAAO,eAAeU,sCAAsCA,CAAA,EAAG;EAC7D,MAAMC,KAAqC,GAAG,CAC5CT,4BAA4B,CAACU,sCAAsC,CACpE;EACD,MAAMC,mBAAmB,GAAG,MAAMd,kBAAkB,CAACe,KAAK,CACxDf,kBAAkB,CAACgB,WAAW,CAACC,MACjC,CAAC;EACD,IAAIH,mBAAmB,EAAE;IACvBF,KAAK,CAACM,IAAI,CAACf,4BAA4B,CAACgB,8BAA8B,CAAC;EACzE;EACA,MAAMC,uBAAuB,GAAG,MAAMpB,kBAAkB,CAACe,KAAK,CAC5Df,kBAAkB,CAACgB,WAAW,CAACK,YACjC,CAAC;EACD,IAAID,uBAAuB,EAAE;IAC3BR,KAAK,CAACM,IAAI,CAACf,4BAA4B,CAACmB,kCAAkC,CAAC;EAC7E;EACA,OAAOV,KAAK;AACd;AAEA,OAAO,SAASW,qCAAqCA,CAAA,EAAG;EACtD,MAAMX,KAAqC,GAAG,CAC5CT,4BAA4B,CAACqB,qCAAqC,CACnE;EACD,OAAOZ,KAAK;AACd","ignoreList":[]}
1
+ {"version":3,"names":["lib","AndroidForegroundServiceType","INSTALLATION_INSTRUCTION","getNotifeeLibThrowIfNotInstalledForPush","Error","getNotifeeLibNoThrowForKeepCallAlive","getIncomingCallForegroundServiceTypes","types","FOREGROUND_SERVICE_TYPE_SHORT_SERVICE"],"sourceRoot":"../../../../../../src","sources":["utils/push/libs/notifee/index.ts"],"mappings":"AAAA,SAASA,GAAG,QAAmB,OAAO;AAAC,IAIlCC,4BAA4B,0BAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAAA,OAA5BA,4BAA4B;AAAA,EAA5BA,4BAA4B;AAkBjC,MAAMC,wBAAwB,GAC5B,6FAA6F;AAE/F,OAAO,SAASC,uCAAuCA,CAAA,EAAG;EACxD,IAAI,CAACH,GAAG,EAAE;IACR,MAAMI,KAAK,CACT,8FAA8F,GAC5FF,wBACJ,CAAC;EACH;EACA,OAAOF,GAAG;AACZ;AAEA,OAAO,SAASK,oCAAoCA,CAAA,EAAG;EACrD,OAAOL,GAAG;AACZ;AAEA,OAAO,SAASM,qCAAqCA,CAAA,EAAG;EACtD,MAAMC,KAAqC,GAAG,CAC5CN,4BAA4B,CAACO,qCAAqC,CACnE;EACD,OAAOD,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,99 @@
1
+ import { videoLoggerSystem } from '@stream-io/video-client';
2
+ import { clearPushWSEventSubscriptions, processCallFromPushInBackground } from './internal/utils';
3
+ import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
4
+ import { resolvePendingAudioSession } from '../internal/callingx/audioSessionPromise';
5
+ import { getCallingxLib } from './libs/callingx';
6
+ import { Platform } from 'react-native';
7
+ const logger = videoLoggerSystem.getLogger('callingx');
8
+
9
+ /**
10
+ * Sets up callingx event listeners for handling call actions from the native calling UI.
11
+ */
12
+ export function setupCallingExpEvents(pushConfig) {
13
+ const hasPushProvider = Platform.OS === 'android' && pushConfig.android?.pushProviderName || Platform.OS === 'ios' && pushConfig.ios?.pushProviderName;
14
+ if (!hasPushProvider) {
15
+ return;
16
+ }
17
+ const callingx = getCallingxLib();
18
+ const {
19
+ remove: removeAnswerCall
20
+ } = callingx.addEventListener('answerCall', params => {
21
+ onAcceptCall(pushConfig)(params);
22
+ });
23
+ const {
24
+ remove: removeEndCall
25
+ } = callingx.addEventListener('endCall', params => {
26
+ onEndCall(pushConfig)(params);
27
+ });
28
+ const {
29
+ remove: removeDidActivateAudioSession
30
+ } = callingx.addEventListener('didActivateAudioSession', onDidActivateAudioSession);
31
+ const {
32
+ remove: removeDidDeactivateAudioSession
33
+ } = callingx.addEventListener('didDeactivateAudioSession', onDidDeactivateAudioSession);
34
+
35
+ //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
36
+ //in most cases there will be no delayed answers or ends, but if so we don't want to miss any of them
37
+ const events = callingx.getInitialEvents();
38
+ events.forEach(event => {
39
+ const {
40
+ eventName,
41
+ params
42
+ } = event;
43
+ if (eventName === 'answerCall') {
44
+ logger.debug(`answerCall delayed event callId: ${params?.callId}`);
45
+ onAcceptCall(pushConfig)(params);
46
+ } else if (eventName === 'endCall') {
47
+ logger.debug(`endCall delayed event callId: ${params?.callId}`);
48
+ onEndCall(pushConfig)(params);
49
+ } else if (eventName === 'didActivateAudioSession') {
50
+ onDidActivateAudioSession();
51
+ } else if (eventName === 'didDeactivateAudioSession') {
52
+ onDidDeactivateAudioSession();
53
+ }
54
+ });
55
+ setPushLogoutCallback(async () => {
56
+ removeAnswerCall();
57
+ removeEndCall();
58
+ removeDidActivateAudioSession();
59
+ removeDidDeactivateAudioSession();
60
+ });
61
+ }
62
+ const onDidActivateAudioSession = () => {
63
+ logger.debug('callingExpDidActivateAudioSession');
64
+ resolvePendingAudioSession();
65
+ };
66
+ const onDidDeactivateAudioSession = () => {
67
+ logger.debug('callingExpDidDeactivateAudioSession');
68
+ };
69
+ const onAcceptCall = pushConfig => ({
70
+ callId: call_cid,
71
+ source
72
+ }) => {
73
+ logger.debug(`onAcceptCall event call_cid: ${call_cid} source: ${source}`);
74
+ if (source === 'app' || !call_cid) {
75
+ // App-initiated actions are fulfilled on the native side immediately — nothing to do here
76
+ return;
77
+ }
78
+ const callingx = getCallingxLib();
79
+ clearPushWSEventSubscriptions(call_cid);
80
+ processCallFromPushInBackground(pushConfig, call_cid, 'accept', didFail => {
81
+ callingx.fulfillAnswerCallAction(call_cid, didFail);
82
+ });
83
+ };
84
+ const onEndCall = pushConfig => ({
85
+ callId: call_cid,
86
+ source
87
+ }) => {
88
+ logger.debug(`onEndCall event call_cid: ${call_cid} source: ${source}`);
89
+ if (source === 'app' || !call_cid) {
90
+ // App-initiated actions are fulfilled on the native side immediately — nothing to do here
91
+ return;
92
+ }
93
+ const callingx = getCallingxLib();
94
+ clearPushWSEventSubscriptions(call_cid);
95
+ processCallFromPushInBackground(pushConfig, call_cid, 'decline', didFail => {
96
+ callingx.fulfillEndCallAction(call_cid, didFail);
97
+ });
98
+ };
99
+ //# sourceMappingURL=setupCallingExpEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["videoLoggerSystem","clearPushWSEventSubscriptions","processCallFromPushInBackground","setPushLogoutCallback","resolvePendingAudioSession","getCallingxLib","Platform","logger","getLogger","setupCallingExpEvents","pushConfig","hasPushProvider","OS","android","pushProviderName","ios","callingx","remove","removeAnswerCall","addEventListener","params","onAcceptCall","removeEndCall","onEndCall","removeDidActivateAudioSession","onDidActivateAudioSession","removeDidDeactivateAudioSession","onDidDeactivateAudioSession","events","getInitialEvents","forEach","event","eventName","debug","callId","call_cid","source","didFail","fulfillAnswerCallAction","fulfillEndCallAction"],"sourceRoot":"../../../../src","sources":["utils/push/setupCallingExpEvents.ts"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,yBAAyB;AAE3D,SACEC,6BAA6B,EAC7BC,+BAA+B,QAC1B,kBAAkB;AACzB,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,SAASC,0BAA0B,QAAQ,0CAA0C;AACrF,SACEC,cAAc,QAGT,iBAAiB;AACxB,SAASC,QAAQ,QAAQ,cAAc;AAIvC,MAAMC,M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ACsB,uBAAuB,CAACH,QAAQ,EAAEE,OAAO,CAAC;EACrD,CACF,CAAC;AACH,CAAC;AAEH,MAAMd,SAAS,GACZb,UAAsB,IACvB,CAAC;EAAEwB,MAAM,EAAEC,QAAQ;EAAEC;AAA+B,CAAC,KAAK;EACxD7B,MAAM,CAAC0B,KAAK,CAAC,6BAA6BE,QAAQ,YAAYC,MAAM,EAAE,CAAC;EAEvE,IAAIA,MAAM,KAAK,KAAK,IAAI,CAACD,QAAQ,EAAE;IACjC;IACA;EACF;EAEA,MAAMnB,QAAQ,GAAGX,cAAc,CAAC,CAAC;EACjCJ,6BAA6B,CAACkC,QAAQ,CAAC;EACvCjC,+BAA+B,CAC7BQ,UAAU,EACVyB,QAAQ,EACR,SAAS,EACRE,OAAO,IAAK;IACXrB,QAAQ,CAACuB,oBAAoB,CAACJ,QAAQ,EAAEE,OAAO,CAAC;EAClD,CACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,8 +1,10 @@
1
- import { getVoipPushNotificationLib } from './libs';
1
+ // import { getVoipPushNotificationLib } from './libs';
2
+
2
3
  import { Platform } from 'react-native';
3
4
  import { onVoipNotificationReceived } from './internal/ios';
4
5
  import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
5
6
  import { videoLoggerSystem } from '@stream-io/video-client';
7
+ import { getCallingxLib } from './libs';
6
8
  export function setupIosVoipPushEvents(pushConfig) {
7
9
  if (Platform.OS !== 'ios' || !pushConfig.ios?.pushProviderName) {
8
10
  return;
@@ -13,14 +15,13 @@ export function setupIosVoipPushEvents(pushConfig) {
13
15
  logger.debug('ios pushProviderName is not defined, so skipping the setupIosVoipPushEvents');
14
16
  return;
15
17
  }
16
- const voipPushNotification = getVoipPushNotificationLib();
17
- logger.debug('notification event listener added');
18
- voipPushNotification.addEventListener('notification', notification => {
19
- onVoipNotificationReceived(notification, pushConfig);
18
+ const callingx = getCallingxLib();
19
+ const voipNotificationReceivedListener = callingx.addEventListener('voipNotificationReceived', params => {
20
+ onVoipNotificationReceived(params, pushConfig);
20
21
  });
21
22
  setPushLogoutCallback(async () => {
22
23
  videoLoggerSystem.getLogger('setPushLogoutCallback').debug('notification event listener removed');
23
- voipPushNotification.removeEventListener('notification');
24
+ voipNotificationReceivedListener.remove();
24
25
  });
25
26
  }
26
27
  //# sourceMappingURL=setupIosVoipPushEvents.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getVoipPushNotificationLib","Platform","onVoipNotificationReceived","setPushLogoutCallback","videoLoggerSystem","setupIosVoipPushEvents","pushConfig","OS","ios","pushProviderName","logger","getLogger","debug","voipPushNotification","addEventListener","notification","removeEventListener"],"sourceRoot":"../../../../src","sources":["utils/push/setupIosVoipPushEvents.ts"],"mappings":"AAAA,SAASA,0BAA0B,QAAQ,QAAQ;AAEnD,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,0BAA0B,QAAQ,gBAAgB;AAC3D,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,SAASC,iBAAiB,QAAQ,yBAAyB;AAE3D,OAAO,SAASC,sBAAsBA,CACpCC,UAAkD,EAClD;EACA,IAAIL,QAAQ,CAACM,EAAE,KAAK,KAAK,IAAI,CAACD,UAAU,CAACE,GAAG,EAAEC,gBAAgB,EAAE;IAC9D;EACF;EACA,MAAMC,MAAM,GAAGN,iBAAiB,CAACO,SAAS,CAAC,wBAAwB,CAAC;EACpE,IAAI,CAACL,UAAU,CAACE,GAAG,CAACC,gBAAgB,EAAE;IACpC;IACAC,MAAM,CAACE,KAAK,CACV,6EACF,CAAC;IACD;EACF;EACA,MAAMC,oBAAoB,GAAGb,0BAA0B,CAAC,CAAC;EAEzDU,MAAM,CAACE,KAAK,CAAC,mCAAmC,CAAC;EACjDC,oBAAoB,CAACC,gBAAgB,CAAC,cAAc,EAAGC,YAAY,IAAK;IACtEb,0BAA0B,CAACa,YAAY,EAAET,UAAU,CAAC;EACtD,CAAC,CAAC;EACFH,qBAAqB,CAAC,YAAY;IAChCC,iBAAiB,CACdO,SAAS,CAAC,uBAAuB,CAAC,CAClCC,KAAK,CAAC,qCAAqC,CAAC;IAC/CC,oBAAoB,CAACG,mBAAmB,CAAC,cAAc,CAAC;EAC1D,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["Platform","onVoipNotificationReceived","setPushLogoutCallback","videoLoggerSystem","getCallingxLib","setupIosVoipPushEvents","pushConfig","OS","ios","pushProviderName","logger","getLogger","debug","callingx","voipNotificationReceivedListener","addEventListener","params","remove"],"sourceRoot":"../../../../src","sources":["utils/push/setupIosVoipPushEvents.ts"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,0BAA0B,QAAQ,gBAAgB;AAC3D,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,cAAc,QAAQ,QAAQ;AAEvC,OAAO,SAASC,sBAAsBA,CACpCC,UAAkD,EAClD;EACA,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,IAAI,CAACD,UAAU,CAACE,GAAG,EAAEC,gBAAgB,EAAE;IAC9D;EACF;EACA,MAAMC,MAAM,GAAGP,iBAAiB,CAACQ,SAAS,CAAC,wBAAwB,CAAC;EACpE,IAAI,CAACL,UAAU,CAACE,GAAG,CAACC,gBAAgB,EAAE;IACpC;IACAC,MAAM,CAACE,KAAK,CACV,6EACF,CAAC;IACD;EACF;EAEA,MAAMC,QAAQ,GAAGT,cAAc,CAAC,CAAC;EACjC,MAAMU,gCAAgC,GAAGD,QAAQ,CAACE,gBAAgB,CAChE,0BAA0B,EACzBC,MAAM,IAAK;IACVf,0BAA0B,CAACe,MAAM,EAAEV,UAAU,CAAC;EAChD,CACF,CAAC;EAEDJ,qBAAqB,CAAC,YAAY;IAChCC,iBAAiB,CACdQ,SAAS,CAAC,uBAAuB,CAAC,CAClCC,KAAK,CAAC,qCAAqC,CAAC;IAC/CE,gCAAgC,CAACG,MAAM,CAAC,CAAC;EAC3C,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- export const version = '1.30.0';
1
+ export const version = '1.30.1-beta.1';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["version"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["version"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,eAAe","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/index.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,YAMjC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/index.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,YAKjC,CAAC"}
@@ -0,0 +1,5 @@
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