@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
@@ -1,205 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setupIosCallKeepEvents = setupIosCallKeepEvents;
7
- var _rxSubjects = require("./internal/rxSubjects");
8
- var _videoClient = require("@stream-io/video-client");
9
- var _libs = require("./libs");
10
- var _utils = require("./internal/utils");
11
- var _reactNative = require("react-native");
12
- var _reactNativeWebrtc = require("@stream-io/react-native-webrtc");
13
- var _pushLogoutCallback = require("../internal/pushLogoutCallback");
14
- /**
15
- * This hook is used to listen to callkeep events and do the necessary actions
16
- */
17
- function setupIosCallKeepEvents(pushConfig) {
18
- if (_reactNative.Platform.OS !== 'ios' || !pushConfig.ios.pushProviderName) {
19
- return;
20
- }
21
- if (!pushConfig.android.incomingCallChannel) {
22
- // TODO: remove this check and find a better way once we have telecom integration for android
23
- _videoClient.videoLoggerSystem.getLogger('setupIosCallKeepEvents').debug('android incomingCallChannel is not defined, so skipping the setupIosCallKeepEvents');
24
- return;
25
- }
26
- const logger = _videoClient.videoLoggerSystem.getLogger('setupIosCallKeepEvents');
27
- const callkeep = (0, _libs.getCallKeepLib)();
28
- async function getCallCid(callUUID) {
29
- try {
30
- const call_cid = await _reactNative.NativeModules.StreamVideoReactNative.getIncomingCallCid(callUUID);
31
- // in a case that voipPushNotificationCallCId$ is empty (this should not happen as voipPushNotificationCallCId$ is updated in push reception)]
32
- // update it with this call_cid
33
- const voipPushNotificationCallCId = _videoClient.RxUtils.getCurrentValue(_rxSubjects.voipPushNotificationCallCId$);
34
- if (!voipPushNotificationCallCId) {
35
- logger.debug(`voipPushNotificationCallCId$ is empty, updating it with the call_cid: ${call_cid} for callUUID: ${callUUID}`);
36
- _rxSubjects.voipPushNotificationCallCId$.next(call_cid);
37
- }
38
- return call_cid;
39
- } catch {
40
- logger.debug(`Error in getting call cid from native module for callUUID: ${callUUID} - probably the call was already processed, so ignoring this callkeep event`);
41
- }
42
- return undefined;
43
- }
44
- function answerCall(callUUID) {
45
- getCallCid(callUUID).then(call_cid => {
46
- logger.debug(`answerCall event with call_cid: ${call_cid}`);
47
- iosCallkeepAcceptCall(call_cid, callUUID);
48
- });
49
- }
50
- function endCall(callUUID) {
51
- getCallCid(callUUID).then(call_cid => {
52
- logger.debug(`endCall event with call_cid: ${call_cid}`);
53
- iosCallkeepRejectCall(call_cid, callUUID, pushConfig);
54
- });
55
- }
56
-
57
- /**
58
- * CallKeep / CallKit audio-session events -> WebRTC (iOS)
59
- *
60
- * iOS CallKit is the authority that *activates* and *deactivates* the underlying `AVAudioSession`
61
- * when a call is answered/ended from the system UI (lock screen, Call UI, Bluetooth, etc).
62
- *
63
- * WebRTC on iOS wraps `AVAudioSession` with `RTCAudioSession` and its AudioDeviceModule relies on
64
- * being notified of those lifecycle transitions to correctly start/stop audio I/O and keep its
65
- * internal activation state consistent (e.g. activation count, playout/recording start).
66
- *
67
- * If these callbacks don’t reach WebRTC, answering via the native dialer UI can result in:
68
- * - no microphone capture / one-way audio
69
- * - silent playout until the app forces an audio reconfiguration
70
- * - flaky audio routing (speaker/earpiece/Bluetooth) across subsequent calls
71
- *
72
- * We forward CallKeep’s `didActivateAudioSession` / `didDeactivateAudioSession` events to WebRTC’s
73
- * `RTCAudioSession.audioSessionDidActivate()` / `audioSessionDidDeactivate()` methods.
74
- */
75
- function didActivateAudioSession() {
76
- logger.debug('didActivateAudioSession');
77
- _reactNativeWebrtc.RTCAudioSession.audioSessionDidActivate();
78
- }
79
- function didDeactivateAudioSession() {
80
- logger.debug('didDeactivateAudioSession');
81
- _reactNativeWebrtc.RTCAudioSession.audioSessionDidDeactivate();
82
- }
83
- function didDisplayIncomingCall(callUUID, payload) {
84
- const voipPushNotification = (0, _libs.getVoipPushNotificationLib)();
85
- // @ts-expect-error - call_cid is not part of RNCallKeepEventPayload
86
- const call_cid = payload?.call_cid;
87
- logger.debug(`didDisplayIncomingCall event with callUUID: ${callUUID} call_cid: ${call_cid}`);
88
- if (call_cid) {
89
- if (_reactNative.AppState.currentState === 'background') {
90
- (0, _utils.processCallFromPushInBackground)(pushConfig, call_cid, 'backgroundDelivered');
91
- }
92
- _rxSubjects.voipCallkeepCallOnForegroundMap$.next({
93
- uuid: callUUID,
94
- cid: call_cid
95
- });
96
- }
97
- voipPushNotification.onVoipNotificationCompleted(callUUID);
98
- }
99
- const {
100
- remove: removeAnswerCall
101
- } = callkeep.addEventListener('answerCall', ({
102
- callUUID
103
- }) => {
104
- answerCall(callUUID);
105
- });
106
- const {
107
- remove: removeEndCall
108
- } = callkeep.addEventListener('endCall', ({
109
- callUUID
110
- }) => {
111
- endCall(callUUID);
112
- });
113
- const {
114
- remove: removeDisplayIncomingCall
115
- } = callkeep.addEventListener('didDisplayIncomingCall', ({
116
- callUUID,
117
- payload
118
- }) => {
119
- didDisplayIncomingCall(callUUID, payload);
120
- });
121
- const {
122
- remove: removeDidActivateAudioSession
123
- } = callkeep.addEventListener('didActivateAudioSession', () => {
124
- didActivateAudioSession();
125
- });
126
- const {
127
- remove: removeDidDeactivateAudioSession
128
- } = callkeep.addEventListener('didDeactivateAudioSession', () => {
129
- didDeactivateAudioSession();
130
- });
131
- const {
132
- remove: removeDidLoadWithEvents
133
- } = callkeep.addEventListener('didLoadWithEvents', events => {
134
- if (!events || !Array.isArray(events) || events.length < 1) {
135
- return;
136
- }
137
- events.forEach(event => {
138
- const {
139
- name,
140
- data
141
- } = event;
142
- if (name === 'RNCallKeepDidDisplayIncomingCall') {
143
- didDisplayIncomingCall(data.callUUID, data.payload);
144
- } else if (name === 'RNCallKeepPerformAnswerCallAction') {
145
- answerCall(data.callUUID);
146
- } else if (name === 'RNCallKeepPerformEndCallAction') {
147
- endCall(data.callUUID);
148
- } else if (name === 'RNCallKeepDidActivateAudioSession') {
149
- didActivateAudioSession();
150
- } else if (name === 'RNCallKeepDidDeactivateAudioSession') {
151
- didDeactivateAudioSession();
152
- }
153
- });
154
- });
155
- (0, _pushLogoutCallback.setPushLogoutCallback)(async () => {
156
- removeAnswerCall();
157
- removeEndCall();
158
- removeDisplayIncomingCall();
159
- removeDidActivateAudioSession();
160
- removeDidDeactivateAudioSession();
161
- removeDidLoadWithEvents();
162
- });
163
- }
164
- const iosCallkeepAcceptCall = (call_cid, callUUIDFromCallkeep) => {
165
- if (!shouldProcessCallFromCallkeep(call_cid, callUUIDFromCallkeep)) {
166
- return;
167
- }
168
- (0, _utils.clearPushWSEventSubscriptions)(call_cid);
169
- // to call end callkeep later if ended in app and not through callkeep
170
- _rxSubjects.voipCallkeepAcceptedCallOnNativeDialerMap$.next({
171
- uuid: callUUIDFromCallkeep,
172
- cid: call_cid
173
- });
174
- // to process the call in the app
175
- _rxSubjects.pushAcceptedIncomingCallCId$.next(call_cid);
176
- // no need to keep these references anymore
177
- _rxSubjects.voipCallkeepCallOnForegroundMap$.next(undefined);
178
- };
179
- const iosCallkeepRejectCall = async (call_cid, callUUIDFromCallkeep, pushConfig) => {
180
- if (!shouldProcessCallFromCallkeep(call_cid, callUUIDFromCallkeep)) {
181
- return;
182
- }
183
- (0, _utils.clearPushWSEventSubscriptions)(call_cid);
184
- // remove the references if the call_cid matches
185
- const voipPushNotificationCallCId = _videoClient.RxUtils.getCurrentValue(_rxSubjects.voipPushNotificationCallCId$);
186
- if (voipPushNotificationCallCId === call_cid) {
187
- _rxSubjects.voipCallkeepAcceptedCallOnNativeDialerMap$.next(undefined);
188
- _rxSubjects.voipCallkeepCallOnForegroundMap$.next(undefined);
189
- _rxSubjects.voipPushNotificationCallCId$.next(undefined);
190
- }
191
- await (0, _utils.processCallFromPushInBackground)(pushConfig, call_cid, 'decline');
192
- await _reactNative.NativeModules.StreamVideoReactNative?.removeIncomingCall(call_cid);
193
- };
194
-
195
- /**
196
- * Helper function to determine if the answer/end call event from callkeep must be processed
197
- * Just checks if we have a valid call_cid and acts as a type guard for call_cid
198
- */
199
- const shouldProcessCallFromCallkeep = (call_cid, callUUIDFromCallkeep) => {
200
- if (!call_cid || !callUUIDFromCallkeep) {
201
- return false;
202
- }
203
- return true;
204
- };
205
- //# sourceMappingURL=setupIosCallKeepEvents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_rxSubjects","require","_videoClient","_libs","_utils","_reactNative","_reactNativeWebrtc","_pushLogoutCallback","setupIosCallKeepEvents","pushConfig","Platform","OS","ios","pushProviderName","android","incomingCallChannel","videoLoggerSystem","getLogger","debug","logger","callkeep","getCallKeepLib","getCallCid","callUUID","call_cid","NativeModules","StreamVideoReactNative","getIncomingCallCid","voipPushNotificationCallCId","RxUtils","getCurrentValue","voipPushNotificationCallCId$","next","undefined","answerCall","then","iosCallkeepAcceptCall","endCall","iosCallkeepRejectCall","didActivateAudioSession","RTCAudioSession","audioSessionDidActivate","didDeactivateAudioSession","audioSessionDidDeactivate","didDisplayIncomingCall","payload","voipPushNotification","getVoipPushNotificationLib","AppState","currentState","processCallFromPushInBackground","voipCallkeepCallOnForegroundMap$","uuid","cid","onVoipNotificationCompleted","remove","removeAnswerCall","addEventListener","removeEndCall","removeDisplayIncomingCall","removeDidActivateAudioSession","removeDidDeactivateAudioSession","removeDidLoadWithEvents","events","Array","isArray","length","forEach","event","name","data","setPushLogoutCallback","callUUIDFromCallkeep","shouldProcessCallFromCallkeep","clearPushWSEventSubscriptions","voipCallkeepAcceptedCallOnNativeDialerMap$","pushAcceptedIncomingCallCId$","removeIncomingCall"],"sourceRoot":"../../../../src","sources":["utils/push/setupIosCallKeepEvents.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAIA;AACA;AACA;AACO,SAASO,sBAAsBA,CACpCC,UAAkD,EAClD;EACA,IAAIC,qB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Ae,CACzDC,wCACF,CAAC;EACD,IAAIH,2BAA2B,KAAKJ,QAAQ,EAAE;IAC5CmD,sDAA0C,CAAC3C,IAAI,CAACC,SAAS,CAAC;IAC1DkB,4CAAgC,CAACnB,IAAI,CAACC,SAAS,CAAC;IAChDF,wCAA4B,CAACC,IAAI,CAACC,SAAS,CAAC;EAC9C;EAEA,MAAM,IAAAiB,sCAA+B,EAACzC,UAAU,EAAEe,QAAQ,EAAE,SAAS,CAAC;EACtE,MAAMC,0BAAa,CAACC,sBAAsB,EAAEmD,kBAAkB,CAACrD,QAAQ,CAAC;AAC1E,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMiD,6BAA6B,GAAGA,CACpCjD,QAA4B,EAC5BgD,oBAA4B,KACL;EACvB,IAAI,CAAChD,QAAQ,IAAI,CAACgD,oBAAoB,EAAE;IACtC,OAAO,KAAK;EACd;EACA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
@@ -1,153 +0,0 @@
1
- import { CallingState, RxUtils, videoLoggerSystem } from '@stream-io/video-client';
2
- import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
3
- import { NativeModules, Platform } from 'react-native';
4
- import { useEffect, useState } from 'react';
5
- import { StreamVideoRN } from '../../utils';
6
- import { getCallKeepLib } from '../../utils/push/libs';
7
- import { voipCallkeepAcceptedCallOnNativeDialerMap$, voipCallkeepCallOnForegroundMap$, voipPushNotificationCallCId$ } from '../../utils/push/internal/rxSubjects';
8
- const isNonActiveCallingState = callingState => {
9
- return callingState === CallingState.IDLE || callingState === CallingState.UNKNOWN || callingState === CallingState.LEFT;
10
- };
11
- const isAcceptedCallingState = callingState => {
12
- return callingState === CallingState.JOINING || callingState === CallingState.JOINED;
13
- };
14
- const unsubscribeCallkeepEvents = async activeCallCid => {
15
- const voipPushNotificationCallCId = RxUtils.getCurrentValue(voipPushNotificationCallCId$);
16
- if (activeCallCid && activeCallCid === voipPushNotificationCallCId) {
17
- // callkeep events should not be listened anymore so clear the call cid
18
- voipPushNotificationCallCId$.next(undefined);
19
- }
20
- return await NativeModules.StreamVideoReactNative?.removeIncomingCall(activeCallCid);
21
- };
22
- const logger = videoLoggerSystem.getLogger('useIosCallkeepWithCallingStateEffect');
23
- const log = message => {
24
- logger.warn(message);
25
- };
26
-
27
- /**
28
- * This hook is used to inform the callkeep library that the call has been joined or ended.
29
- */
30
- export const useIosCallkeepWithCallingStateEffect = () => {
31
- const activeCall = useCall();
32
- const {
33
- useCallCallingState
34
- } = useCallStateHooks();
35
- const callingState = useCallCallingState();
36
- const [acceptedForegroundCallkeepMap, setAcceptedForegroundCallkeepMap] = useState();
37
- useEffect(() => {
38
- return () => {
39
- const pushConfig = StreamVideoRN.getConfig().push;
40
- if (Platform.OS !== 'ios' || !pushConfig || !pushConfig.ios?.pushProviderName) {
41
- return;
42
- }
43
- if (!pushConfig.android.incomingCallChannel) {
44
- // TODO: remove this check and find a better way once we have telecom integration for android
45
- return;
46
- }
47
- const callkeep = getCallKeepLib();
48
- // if the component is unmounted and the callID was not reported to callkeep, then report it now
49
- if (acceptedForegroundCallkeepMap) {
50
- log(`Ending call in callkeep: ${acceptedForegroundCallkeepMap.cid}, reason: component unmounted and call was present in acceptedForegroundCallkeepMap`);
51
- unsubscribeCallkeepEvents(acceptedForegroundCallkeepMap.cid).then(() => callkeep.endCall(acceptedForegroundCallkeepMap.uuid));
52
- }
53
- };
54
- }, [acceptedForegroundCallkeepMap]);
55
- const activeCallCid = activeCall?.cid;
56
- useEffect(() => {
57
- return () => {
58
- const pushConfig = StreamVideoRN.getConfig().push;
59
- if (Platform.OS !== 'ios' || !pushConfig || !pushConfig.ios?.pushProviderName || !activeCallCid) {
60
- return;
61
- }
62
- if (!pushConfig.android.incomingCallChannel) {
63
- // TODO: remove this check and find a better way once we have telecom integration for android
64
- return;
65
- }
66
- const nativeDialerAcceptedCallMap = RxUtils.getCurrentValue(voipCallkeepAcceptedCallOnNativeDialerMap$);
67
- const foregroundIncomingCallkeepMap = RxUtils.getCurrentValue(voipCallkeepCallOnForegroundMap$);
68
- const callkeep = getCallKeepLib();
69
- if (activeCallCid === nativeDialerAcceptedCallMap?.cid) {
70
- log(`Ending call in callkeep: ${activeCallCid}, reason: activeCallCid changed or was removed and call was present in nativeDialerAcceptedCallMap`);
71
- unsubscribeCallkeepEvents(activeCallCid).then(() => callkeep.endCall(nativeDialerAcceptedCallMap.uuid));
72
- // no need to keep this reference anymore
73
- voipCallkeepAcceptedCallOnNativeDialerMap$.next(undefined);
74
- } else if (activeCallCid === foregroundIncomingCallkeepMap?.cid) {
75
- log(`Ending call in callkeep: ${activeCallCid}, reason: activeCallCid changed or was removed and call was present in foregroundIncomingCallkeepMap`);
76
- unsubscribeCallkeepEvents(activeCallCid).then(() => callkeep.endCall(foregroundIncomingCallkeepMap.uuid));
77
- }
78
- };
79
- }, [activeCallCid]);
80
- const pushConfig = StreamVideoRN.getConfig().push;
81
- if (Platform.OS !== 'ios' || !pushConfig || !pushConfig.ios.pushProviderName || !activeCallCid) {
82
- return;
83
- }
84
- if (!pushConfig.android.incomingCallChannel) {
85
- // TODO: remove this check and find a better way once we have telecom integration for android
86
- return;
87
- }
88
-
89
- /**
90
- * Check if current call is still needed to be accepted in callkeep
91
- */
92
- if (isAcceptedCallingState(callingState) && acceptedForegroundCallkeepMap?.cid !== activeCallCid) {
93
- const callkeep = getCallKeepLib();
94
- // push notification was displayed
95
- // but the call has been accepted through the app and not through the native dialer
96
- const foregroundCallkeepMap = RxUtils.getCurrentValue(voipCallkeepCallOnForegroundMap$);
97
- if (foregroundCallkeepMap && foregroundCallkeepMap.cid === activeCallCid) {
98
- log(
99
- // @ts-expect-error - types issue
100
- `Accepting call in callkeep: ${activeCallCid}, reason: callingstate went to ${CallingState[callingState]} and call was present in foregroundCallkeepMap`);
101
- // no need to keep this reference anymore
102
- voipCallkeepCallOnForegroundMap$.next(undefined);
103
- NativeModules.StreamVideoReactNative?.removeIncomingCall(activeCallCid).then(() => callkeep.answerIncomingCall(foregroundCallkeepMap.uuid));
104
- // this call should be accepted in callkeep
105
- setAcceptedForegroundCallkeepMap(foregroundCallkeepMap);
106
- }
107
- }
108
-
109
- /**
110
- * Check if current call is still needed to be ended in callkeep
111
- */
112
- if (isNonActiveCallingState(callingState)) {
113
- const callkeep = getCallKeepLib();
114
-
115
- // this was a previously joined call which had push notification displayed
116
- // the call was accepted through the app and not through native dialer
117
- // the call was left using the leave button in the app and not through native dialer
118
- if (activeCallCid === acceptedForegroundCallkeepMap?.cid) {
119
- log(
120
- // @ts-expect-error - types issue
121
- `Ending call in callkeep: ${activeCallCid}, reason: callingstate went to ${CallingState[callingState]} and call was present in acceptedForegroundCallkeepMap`);
122
- unsubscribeCallkeepEvents(activeCallCid).then(() => callkeep.endCall(acceptedForegroundCallkeepMap.uuid));
123
- setAcceptedForegroundCallkeepMap(undefined);
124
- return;
125
- }
126
- // this was a call which had push notification displayed but never joined
127
- // the user rejected in the app and not from native dialer
128
- const foregroundIncomingCallkeepMap = RxUtils.getCurrentValue(voipCallkeepCallOnForegroundMap$);
129
- if (activeCallCid === foregroundIncomingCallkeepMap?.cid) {
130
- log(
131
- // @ts-expect-error - types issue
132
- `Ending call in callkeep: ${activeCallCid}, reason: callingstate went to ${CallingState[callingState]} and call was present in foregroundIncomingCallkeepMap`);
133
- unsubscribeCallkeepEvents(activeCallCid).then(() => callkeep.endCall(foregroundIncomingCallkeepMap.uuid));
134
- // no need to keep this reference anymore
135
- voipCallkeepCallOnForegroundMap$.next(undefined);
136
- return;
137
- }
138
- // this was a previously joined call
139
- // it was an accepted call from native dialer and not from the app
140
- // the user left using the leave button in the app
141
- const nativeDialerAcceptedCallMap = RxUtils.getCurrentValue(voipCallkeepAcceptedCallOnNativeDialerMap$);
142
- if (activeCallCid === nativeDialerAcceptedCallMap?.cid) {
143
- log(
144
- // @ts-expect-error - types issue
145
- `Ending call in callkeep: ${activeCallCid}, reason: callingstate went to ${CallingState[callingState]} and call was present in nativeDialerAcceptedCallMap`);
146
- unsubscribeCallkeepEvents(activeCallCid).then(() => callkeep.endCall(nativeDialerAcceptedCallMap.uuid));
147
- // no need to keep this reference anymore
148
- voipCallkeepAcceptedCallOnNativeDialerMap$.next(undefined);
149
- return;
150
- }
151
- }
152
- };
153
- //# sourceMappingURL=useIosCallkeepWithCallingStateEffect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["CallingState","RxUtils","videoLoggerSystem","useCall","useCallStateHooks","NativeModules","Platform","useEffect","useState","StreamVideoRN","getCallKeepLib","voipCallkeepAcceptedCallOnNativeDialerMap$","voipCallkeepCallOnForegroundMap$","voipPushNotificationCallCId$","isNonActiveCallingState","callingState","IDLE","UNKNOWN","LEFT","isAcceptedCallingState","JOINING","JOINED","unsubscribeCallkeepEvents","activeCallCid","voipPushNotificationCallCId","getCurrentValue","next","undefined","StreamVideoReactNative","removeIncomingCall","logger","getLogger","log","message","warn","useIosCallkeepWithCallingStateEffect","activeCall","useCallCallingState","acceptedForegroundCallkeepMap","setAcceptedForegroundCallkeepMap","pushConfig","getConfig","push","OS","ios","pushProviderName","android","incomingCallChannel","callkeep","cid","then","endCall","uuid","nativeDialerAcceptedCallMap","foregroundIncomingCallkeepMap","foregroundCallkeepMap","answerIncomingCall"],"sourceRoot":"../../../../src","sources":["hooks/push/useIosCallkeepWithCallingStateEffect.ts"],"mappings":"AAAA,SACEA,YAAY,EACZC,OAAO,EACPC,iBAAiB,QACZ,yBAAyB;AAChC,SAASC,OAAO,EAAEC,iBAAiB,QAAQ,iCAAiC;AAC5E,SAASC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SACEC,0CAA0C,EAC1CC,gCAAgC,EAChCC,4BAA4B,QACvB,sCAAsC;AAE7C,MAAMC,uBAAuB,GAAIC,YAA0B,IAAK;EAC9D,OACEA,YAAY,KAAKf,YAAY,CAACgB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AAI,CAACC,SAAS,CAAC;MAC1D;IACF;EACF;AACF,CAAC","ignoreList":[]}
@@ -1,60 +0,0 @@
1
- import { pushAcceptedIncomingCallCId$, pushAndroidBackgroundDeliveredIncomingCallCId$, pushRejectedIncomingCallCId$, pushTappedIncomingCallCId$ } from '../../utils/push/internal/rxSubjects';
2
- import { useEffect } from 'react';
3
- import { StreamVideoRN } from '../../utils';
4
- import { useConnectedUser, useStreamVideoClient } from '@stream-io/video-react-bindings';
5
- import { distinctUntilChanged, filter } from 'rxjs/operators';
6
- import { processCallFromPush } from '../../utils/push/internal/utils';
7
- import { videoLoggerSystem } from '@stream-io/video-client';
8
- /**
9
- * This hook is used to process the incoming call data via push notifications using the relevant rxjs subjects
10
- * It either joins or leaves the call based on the user's action.
11
- * Note: this effect cannot work when push notifications are received when the app is in quit state or in other words when the client is not connected with a websocket.
12
- * So we essentially run this effect only when the client is connected with a websocket.
13
- */
14
- export const useProcessPushCallEffect = () => {
15
- const client = useStreamVideoClient();
16
- const connectedUserId = useConnectedUser()?.id;
17
- // The Effect to join/reject call automatically when incoming call was received and processed from push notification
18
- useEffect(() => {
19
- const pushConfig = StreamVideoRN.getConfig().push;
20
- if (!pushConfig || !client || !connectedUserId) {
21
- return;
22
- }
23
- videoLoggerSystem.getLogger('useProcessPushCallEffect').debug(`Adding subscriptions to process incoming call from push notification`);
24
-
25
- // if the user accepts the call from push notification we join the call
26
- const acceptedCallSubscription = createCallSubscription(pushAcceptedIncomingCallCId$, client, pushConfig, 'accept');
27
-
28
- // if the user rejects the call from push notification we leave the call
29
- const declinedCallSubscription = createCallSubscription(pushRejectedIncomingCallCId$, client, pushConfig, 'decline');
30
-
31
- // if the user taps the call from push notification we do nothing as the only thing is to get the call which adds it to the client
32
- const pressedCallSubscription = createCallSubscription(pushTappedIncomingCallCId$, client, pushConfig, 'pressed');
33
- const backgroundIncomingDeliveredCallSubscription = createCallSubscription(pushAndroidBackgroundDeliveredIncomingCallCId$, client, pushConfig, 'backgroundDelivered');
34
- return () => {
35
- acceptedCallSubscription.unsubscribe();
36
- declinedCallSubscription.unsubscribe();
37
- pressedCallSubscription.unsubscribe();
38
- backgroundIncomingDeliveredCallSubscription.unsubscribe();
39
- };
40
- }, [client, connectedUserId]);
41
- };
42
-
43
- /**
44
- * A type guard to check if the cid is not undefined
45
- */
46
- function cidIsNotUndefined(cid) {
47
- return cid !== undefined;
48
- }
49
-
50
- /**
51
- * The common logic to create a subscription for the given call cid and action
52
- */
53
- const createCallSubscription = (behaviourSubjectWithCallCid, client, pushConfig, action) => {
54
- return behaviourSubjectWithCallCid.pipe(distinctUntilChanged(), filter(cidIsNotUndefined)).subscribe(async callCId => {
55
- videoLoggerSystem.getLogger('useProcessPushCallEffect').debug(`Processing call from push notification with action: ${action} and callCId: ${callCId}`);
56
- await processCallFromPush(client, callCId, action, pushConfig);
57
- behaviourSubjectWithCallCid.next(undefined); // remove the current call id to avoid processing again
58
- });
59
- };
60
- //# sourceMappingURL=useProcessPushCallEffect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["pushAcceptedIncomingCallCId$","pushAndroidBackgroundDeliveredIncomingCallCId$","pushRejectedIncomingCallCId$","pushTappedIncomingCallCId$","useEffect","StreamVideoRN","useConnectedUser","useStreamVideoClient","distinctUntilChanged","filter","processCallFromPush","videoLoggerSystem","useProcessPushCallEffect","client","connectedUserId","id","pushConfig","getConfig","push","getLogger","debug","acceptedCallSubscription","createCallSubscription","declinedCallSubscription","pressedCallSubscription","backgroundIncomingDeliveredCallSubscription","unsubscribe","cidIsNotUndefined","cid","undefined","behaviourSubjectWithCallCid","action","pipe","subscribe","callCId","next"],"sourceRoot":"../../../../src","sources":["hooks/push/useProcessPushCallEffect.ts"],"mappings":"AAAA,SACEA,4BAA4B,EAC5BC,8CAA8C,EAC9CC,4BAA4B,EAC5BC,0BAA0B,QACrB,sCAAsC;AAC7C,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,aAAa,QAAQ,aAAa;AAC3C,SACEC,g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e,CAAC,CAAC;AAC/B,CAAC;;AAED;AACA;AACA;AACA,SAASa,iBAAiBA,CAACC,GAAuB,EAAiB;EACjE,OAAOA,GAAG,KAAKC,SAAS;AAC1B;;AAEA;AACA;AACA;AACA,MAAMP,sBAAsB,GAAGA,CAC7BQ,2BAAgE,EAChEjB,MAAyB,EACzBG,UAAkD,EAClDe,MAAgE,KAC7D;EACH,OAAOD,2BAA2B,CAC/BE,IAAI,CAACxB,oBAAoB,CAAC,CAAC,EAAEC,MAAM,CAACkB,iBAAiB,CAAC,CAAC,CACvDM,SAAS,CAAC,MAAOC,OAAO,IAAK;IAC5BvB,iBAAiB,CACdQ,SAAS,CAAC,0BAA0B,CAAC,CACrCC,KAAK,CACJ,uDAAuDW,MAAM,iBAAiBG,OAAO,EACvF,CAAC;IACH,MAAMxB,mBAAmB,CAACG,MAAM,EAAEqB,OAAO,EAAEH,MAAM,EAAEf,UAAU,CAAC;IAC9Dc,2BAA2B,CAACK,IAAI,CAACN,SAAS,CAAC,CAAC,CAAC;EAC/C,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- let callkeep;
2
- try {
3
- callkeep = require('react-native-callkeep').default;
4
- } catch {}
5
- export function getCallKeepLib() {
6
- if (!callkeep) {
7
- throw Error('react-native-callkeep library is not installed. Please see https://github.com/react-native-webrtc/react-native-callkeep#Installation for installation instructions');
8
- }
9
- return callkeep;
10
- }
11
- //# sourceMappingURL=callkeep.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["callkeep","require","default","getCallKeepLib","Error"],"sourceRoot":"../../../../../src","sources":["utils/push/libs/callkeep.ts"],"mappings":"AAEA,IAAIA,QAAoC;AAExC,IAAI;EACFA,QAAQ,GAAGC,OAAO,CAAC,uBAAuB,CAAC,CAACC,OAAO;AACrD,CAAC,CAAC,MAAM,CAAC;AAET,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,IAAI,CAACH,QAAQ,EAAE;IACb,MAAMI,KAAK,CACT,oKACF,CAAC;EACH;EACA,OAAOJ,QAAQ;AACjB","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- let voipPushNotification;
2
- try {
3
- voipPushNotification = require('react-native-voip-push-notification').default;
4
- } catch {}
5
- export function getVoipPushNotificationLib() {
6
- if (!voipPushNotification) {
7
- throw Error("react-native-voip-push-notification library is not installed. Please install it using 'yarn add react-native-voip-push-notification' or 'npm i react-native-voip-push-notification --save'");
8
- }
9
- return voipPushNotification;
10
- }
11
- //# sourceMappingURL=voipPushNotification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["voipPushNotification","require","default","getVoipPushNotificationLib","Error"],"sourceRoot":"../../../../../src","sources":["utils/push/libs/voipPushNotification.ts"],"mappings":"AAGA,IAAIA,oBAA0D;AAE9D,IAAI;EACFA,oBAAoB,GAAGC,OAAO,CAAC,qCAAqC,CAAC,CAACC,OAAO;AAC/E,CAAC,CAAC,MAAM,CAAC;AAET,OAAO,SAASC,0BAA0BA,CAAA,EAAG;EAC3C,IAAI,CAACH,oBAAoB,EAAE;IACzB,MAAMI,KAAK,CACT,4LACF,CAAC;EACH;EACA,OAAOJ,oBAAoB;AAC7B","ignoreList":[]}