@stream-io/video-react-native-sdk 1.30.5 → 1.31.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/android/src/main/AndroidManifest.xml +8 -1
  3. package/android/src/main/AndroidManifestNew.xml +11 -0
  4. package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +127 -5
  5. package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +70 -6
  6. package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +6 -4
  7. package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +83 -0
  8. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +149 -0
  9. package/android/src/main/java/com/streamvideo/reactnative/screenshare/ScreenAudioCapture.kt +111 -0
  10. package/dist/commonjs/components/Call/CallControls/ScreenShareToggleButton.js +3 -2
  11. package/dist/commonjs/components/Call/CallControls/ScreenShareToggleButton.js.map +1 -1
  12. package/dist/commonjs/hooks/index.js +11 -0
  13. package/dist/commonjs/hooks/index.js.map +1 -1
  14. package/dist/commonjs/hooks/push/index.js +0 -2
  15. package/dist/commonjs/hooks/push/index.js.map +1 -1
  16. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +144 -0
  17. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  18. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  19. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  20. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +64 -97
  21. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  22. package/dist/commonjs/hooks/useScreenShareAudioMixing.js +126 -0
  23. package/dist/commonjs/hooks/useScreenShareAudioMixing.js.map +1 -0
  24. package/dist/commonjs/hooks/useScreenShareButton.js +57 -3
  25. package/dist/commonjs/hooks/useScreenShareButton.js.map +1 -1
  26. package/dist/commonjs/index.js +1 -0
  27. package/dist/commonjs/index.js.map +1 -1
  28. package/dist/commonjs/modules/ScreenShareAudioManager.js +54 -0
  29. package/dist/commonjs/modules/ScreenShareAudioManager.js.map +1 -0
  30. package/dist/commonjs/modules/call-manager/CallManager.js +26 -0
  31. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  32. package/dist/commonjs/providers/StreamCall/index.js +16 -6
  33. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  34. package/dist/commonjs/utils/StreamVideoRN/index.js +35 -21
  35. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  36. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +68 -0
  37. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  38. package/dist/commonjs/utils/internal/callingx/callingx.js +150 -0
  39. package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -0
  40. package/dist/commonjs/utils/internal/registerSDKGlobals.js +53 -3
  41. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  42. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +48 -0
  43. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +1 -0
  44. package/dist/commonjs/utils/push/android.js +135 -202
  45. package/dist/commonjs/utils/push/android.js.map +1 -1
  46. package/dist/commonjs/utils/push/internal/ios.js +17 -34
  47. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  48. package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -45
  49. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  50. package/dist/commonjs/utils/push/internal/utils.js +71 -53
  51. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  52. package/dist/commonjs/utils/push/ios.js.map +1 -1
  53. package/dist/commonjs/utils/push/libs/callingx.js +75 -0
  54. package/dist/commonjs/utils/push/libs/callingx.js.map +1 -0
  55. package/dist/commonjs/utils/push/libs/index.js +8 -19
  56. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  57. package/dist/commonjs/utils/push/libs/notifee/index.js +0 -19
  58. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  59. package/dist/commonjs/utils/push/setupCallingExpEvents.js +105 -0
  60. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -0
  61. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +7 -6
  62. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  63. package/dist/commonjs/version.js +1 -1
  64. package/dist/commonjs/version.js.map +1 -1
  65. package/dist/module/components/Call/CallControls/ScreenShareToggleButton.js +3 -2
  66. package/dist/module/components/Call/CallControls/ScreenShareToggleButton.js.map +1 -1
  67. package/dist/module/hooks/index.js +1 -0
  68. package/dist/module/hooks/index.js.map +1 -1
  69. package/dist/module/hooks/push/index.js +0 -2
  70. package/dist/module/hooks/push/index.js.map +1 -1
  71. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +137 -0
  72. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  73. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  74. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  75. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +66 -99
  76. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  77. package/dist/module/hooks/useScreenShareAudioMixing.js +119 -0
  78. package/dist/module/hooks/useScreenShareAudioMixing.js.map +1 -0
  79. package/dist/module/hooks/useScreenShareButton.js +57 -3
  80. package/dist/module/hooks/useScreenShareButton.js.map +1 -1
  81. package/dist/module/index.js +1 -0
  82. package/dist/module/index.js.map +1 -1
  83. package/dist/module/modules/ScreenShareAudioManager.js +47 -0
  84. package/dist/module/modules/ScreenShareAudioManager.js.map +1 -0
  85. package/dist/module/modules/call-manager/CallManager.js +26 -0
  86. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  87. package/dist/module/providers/StreamCall/index.js +16 -6
  88. package/dist/module/providers/StreamCall/index.js.map +1 -1
  89. package/dist/module/utils/StreamVideoRN/index.js +35 -21
  90. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  91. package/dist/module/utils/internal/callingx/audioSessionPromise.js +61 -0
  92. package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  93. package/dist/module/utils/internal/callingx/callingx.js +140 -0
  94. package/dist/module/utils/internal/callingx/callingx.js.map +1 -0
  95. package/dist/module/utils/internal/registerSDKGlobals.js +53 -3
  96. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  97. package/dist/module/utils/keepCallAliveHeadlessTask.js +42 -0
  98. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +1 -0
  99. package/dist/module/utils/push/android.js +137 -204
  100. package/dist/module/utils/push/android.js.map +1 -1
  101. package/dist/module/utils/push/internal/ios.js +17 -34
  102. package/dist/module/utils/push/internal/ios.js.map +1 -1
  103. package/dist/module/utils/push/internal/rxSubjects.js +0 -44
  104. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  105. package/dist/module/utils/push/internal/utils.js +67 -50
  106. package/dist/module/utils/push/internal/utils.js.map +1 -1
  107. package/dist/module/utils/push/ios.js.map +1 -1
  108. package/dist/module/utils/push/libs/callingx.js +67 -0
  109. package/dist/module/utils/push/libs/callingx.js.map +1 -0
  110. package/dist/module/utils/push/libs/index.js +1 -2
  111. package/dist/module/utils/push/libs/index.js.map +1 -1
  112. package/dist/module/utils/push/libs/notifee/index.js +0 -18
  113. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  114. package/dist/module/utils/push/setupCallingExpEvents.js +99 -0
  115. package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -0
  116. package/dist/module/utils/push/setupIosVoipPushEvents.js +7 -6
  117. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  118. package/dist/module/version.js +1 -1
  119. package/dist/module/version.js.map +1 -1
  120. package/dist/typescript/components/Call/CallControls/ScreenShareToggleButton.d.ts +6 -1
  121. package/dist/typescript/components/Call/CallControls/ScreenShareToggleButton.d.ts.map +1 -1
  122. package/dist/typescript/hooks/index.d.ts +1 -0
  123. package/dist/typescript/hooks/index.d.ts.map +1 -1
  124. package/dist/typescript/hooks/push/index.d.ts.map +1 -1
  125. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +5 -0
  126. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -0
  127. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  128. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  129. package/dist/typescript/hooks/useScreenShareAudioMixing.d.ts +14 -0
  130. package/dist/typescript/hooks/useScreenShareAudioMixing.d.ts.map +1 -0
  131. package/dist/typescript/hooks/useScreenShareButton.d.ts +39 -2
  132. package/dist/typescript/hooks/useScreenShareButton.d.ts.map +1 -1
  133. package/dist/typescript/index.d.ts +1 -0
  134. package/dist/typescript/index.d.ts.map +1 -1
  135. package/dist/typescript/modules/ScreenShareAudioManager.d.ts +28 -0
  136. package/dist/typescript/modules/ScreenShareAudioManager.d.ts.map +1 -0
  137. package/dist/typescript/modules/call-manager/CallManager.d.ts +5 -0
  138. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  139. package/dist/typescript/providers/StreamCall/index.d.ts.map +1 -1
  140. package/dist/typescript/utils/StreamVideoRN/index.d.ts +22 -2
  141. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  142. package/dist/typescript/utils/StreamVideoRN/types.d.ts +59 -25
  143. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  144. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +16 -0
  145. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +1 -0
  146. package/dist/typescript/utils/internal/callingx/callingx.d.ts +18 -0
  147. package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -0
  148. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  149. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +10 -0
  150. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +1 -0
  151. package/dist/typescript/utils/push/android.d.ts +1 -2
  152. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  153. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  154. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -33
  155. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  156. package/dist/typescript/utils/push/internal/utils.d.ts +14 -8
  157. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  158. package/dist/typescript/utils/push/ios.d.ts +1 -2
  159. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  160. package/dist/typescript/utils/push/libs/callingx.d.ts +9 -0
  161. package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -0
  162. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts +16 -2
  163. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
  164. package/dist/typescript/utils/push/libs/index.d.ts +1 -2
  165. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  166. package/dist/typescript/utils/push/libs/notifee/index.d.ts +0 -1
  167. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  168. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +8 -0
  169. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -0
  170. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  171. package/dist/typescript/version.d.ts +1 -1
  172. package/dist/typescript/version.d.ts.map +1 -1
  173. package/expo-config-plugin/dist/withAndroidManifest.js +1 -33
  174. package/expo-config-plugin/dist/withAndroidPermissions.js +2 -7
  175. package/expo-config-plugin/dist/withAppDelegate.js +19 -197
  176. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  177. package/expo-config-plugin/dist/withiOSInfoPlist.js +2 -3
  178. package/ios/StreamInCallManager.m +2 -0
  179. package/ios/StreamInCallManager.swift +19 -7
  180. package/ios/StreamVideoReactNative.h +7 -4
  181. package/ios/StreamVideoReactNative.m +282 -86
  182. package/package.json +13 -18
  183. package/src/components/Call/CallControls/ScreenShareToggleButton.tsx +11 -1
  184. package/src/hooks/index.ts +1 -0
  185. package/src/hooks/push/index.ts +0 -2
  186. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +189 -0
  187. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +21 -34
  188. package/src/hooks/useAndroidKeepCallAliveEffect.ts +94 -120
  189. package/src/hooks/useScreenShareAudioMixing.ts +130 -0
  190. package/src/hooks/useScreenShareButton.ts +87 -2
  191. package/src/index.ts +1 -0
  192. package/src/modules/ScreenShareAudioManager.ts +49 -0
  193. package/src/modules/call-manager/CallManager.ts +36 -0
  194. package/src/modules/call-manager/native-module.d.ts +7 -0
  195. package/src/providers/StreamCall/index.tsx +17 -6
  196. package/src/utils/StreamVideoRN/index.ts +42 -30
  197. package/src/utils/StreamVideoRN/types.ts +61 -25
  198. package/src/utils/internal/callingx/audioSessionPromise.ts +65 -0
  199. package/src/utils/internal/callingx/callingx.ts +194 -0
  200. package/src/utils/internal/registerSDKGlobals.ts +52 -4
  201. package/src/utils/keepCallAliveHeadlessTask.ts +54 -0
  202. package/src/utils/push/android.ts +198 -311
  203. package/src/utils/push/internal/ios.ts +28 -44
  204. package/src/utils/push/internal/rxSubjects.ts +0 -61
  205. package/src/utils/push/internal/utils.ts +108 -64
  206. package/src/utils/push/ios.ts +1 -6
  207. package/src/utils/push/libs/callingx.ts +89 -0
  208. package/src/utils/push/libs/index.ts +1 -2
  209. package/src/utils/push/libs/notifee/index.ts +0 -27
  210. package/src/utils/push/setupCallingExpEvents.ts +135 -0
  211. package/src/utils/push/setupIosVoipPushEvents.ts +11 -7
  212. package/src/version.ts +1 -1
  213. package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +0 -95
  214. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -160
  215. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  216. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +0 -67
  217. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +0 -1
  218. package/dist/commonjs/utils/push/libs/callkeep.js +0 -17
  219. package/dist/commonjs/utils/push/libs/callkeep.js.map +0 -1
  220. package/dist/commonjs/utils/push/libs/voipPushNotification.js +0 -17
  221. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +0 -1
  222. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +0 -205
  223. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +0 -1
  224. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -153
  225. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  226. package/dist/module/hooks/push/useProcessPushCallEffect.js +0 -60
  227. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +0 -1
  228. package/dist/module/utils/push/libs/callkeep.js +0 -11
  229. package/dist/module/utils/push/libs/callkeep.js.map +0 -1
  230. package/dist/module/utils/push/libs/voipPushNotification.js +0 -11
  231. package/dist/module/utils/push/libs/voipPushNotification.js.map +0 -1
  232. package/dist/module/utils/push/setupIosCallKeepEvents.js +0 -199
  233. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +0 -1
  234. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +0 -5
  235. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +0 -1
  236. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +0 -8
  237. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +0 -1
  238. package/dist/typescript/utils/push/libs/callkeep.d.ts +0 -3
  239. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +0 -1
  240. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +0 -3
  241. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +0 -1
  242. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +0 -6
  243. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +0 -1
  244. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +0 -235
  245. package/src/hooks/push/useProcessPushCallEffect.ts +0 -108
  246. package/src/utils/push/libs/callkeep.ts +0 -16
  247. package/src/utils/push/libs/voipPushNotification.ts +0 -17
  248. package/src/utils/push/setupIosCallKeepEvents.ts +0 -252
@@ -5,20 +5,70 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.registerSDKGlobals = registerSDKGlobals;
7
7
  var _reactNative = require("react-native");
8
+ var _callingx = require("../push/libs/callingx");
9
+ var _callingx2 = require("./callingx/callingx");
8
10
  const StreamInCallManagerNativeModule = _reactNative.NativeModules.StreamInCallManager;
9
11
  const StreamVideoReactNativeModule = _reactNative.NativeModules.StreamVideoReactNative;
12
+ const CallingxModule = (0, _callingx.getCallingxLibIfAvailable)();
13
+
14
+ /**
15
+ * Checks if StreamInCallManager should be bypassed because CallKit is handling
16
+ * the audio session via CallingX.
17
+ *
18
+ * On iOS, when CallingX is set up and has a registered call, the audio session
19
+ * is managed by CallKit through CallingxImpl.swift.
20
+ * In this case, StreamInCallManager should not run to avoid conflicting audio
21
+ * session configurations.
22
+ */
23
+ const shouldBypassForCallKit = ({
24
+ isRingingTypeCall
25
+ }) => {
26
+ if (_reactNative.Platform.OS !== 'ios') {
27
+ return false;
28
+ }
29
+ if (!CallingxModule) {
30
+ return false;
31
+ }
32
+ const bypass = CallingxModule.isSetup && (isRingingTypeCall || CallingxModule.isOngoingCallsEnabled);
33
+ return bypass;
34
+ };
10
35
  const streamRNVideoSDKGlobals = {
36
+ callingX: {
37
+ joinCall: _callingx2.joinCallingxCall,
38
+ endCall: _callingx2.endCallingxCall,
39
+ registerOutgoingCall: _callingx2.registerOutgoingCall
40
+ },
11
41
  callManager: {
12
42
  setup: ({
13
- defaultDevice
43
+ defaultDevice,
44
+ isRingingTypeCall
14
45
  }) => {
46
+ if (shouldBypassForCallKit({
47
+ isRingingTypeCall
48
+ })) {
49
+ return;
50
+ }
15
51
  StreamInCallManagerNativeModule.setDefaultAudioDeviceEndpointType(defaultDevice);
16
52
  StreamInCallManagerNativeModule.setup();
17
53
  },
18
- start: () => {
54
+ start: ({
55
+ isRingingTypeCall
56
+ }) => {
57
+ if (shouldBypassForCallKit({
58
+ isRingingTypeCall
59
+ })) {
60
+ return;
61
+ }
19
62
  StreamInCallManagerNativeModule.start();
20
63
  },
21
- stop: () => {
64
+ stop: ({
65
+ isRingingTypeCall
66
+ }) => {
67
+ if (shouldBypassForCallKit({
68
+ isRingingTypeCall
69
+ })) {
70
+ return;
71
+ }
22
72
  StreamInCallManagerNativeModule.stop();
23
73
  }
24
74
  },
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","StreamInCallManagerNativeModule","NativeModules","StreamInCallManager","StreamVideoReactNativeModule","StreamVideoReactNative","streamRNVideoSDKGlobals","callManager","setup","defaultDevice","setDefaultAudioDeviceEndpointType","start","stop","permissions","check","permission","Platform","OS","nativeAndroidPermission","PermissionsAndroid","PERMISSIONS","CAMERA","RECORD_AUDIO","Boolean","checkPermission","registerSDKGlobals","global","streamRNVideoSDK"],"sourceRoot":"../../../../src","sources":["utils/internal/registerSDKGlobals.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,+BAA+B,GAAGC,0BAAa,CAACC,mBAAmB;AACzE,MAAMC,4BAA4B,GAAGF,0BAAa,CAACG,sBAElD;AAED,MAAMC,uBAAgD,GAAG;EACvDC,WAAW,EAAE;IACXC,KAAK,EAAEA,CAAC;MAAEC;IAAc,CAAC,KAAK;MAC5BR,+BAA+B,CAACS,iCAAiC,CAC/DD,aACF,CAAC;MACDR,+BAA+B,CAACO,KAAK,CAAC,CAAC;IACzC,CAAC;IACDG,KAAK,EAAEA,CAAA,KAAM;MACXV,+BAA+B,CAACU,KAAK,CAAC,CAAC;IACzC,CAAC;IACDC,IAAI,EAAEA,CAAA,KAAM;MACVX,+BAA+B,CAACW,IAAI,CAAC,CAAC;IACxC;EACF,CAAC;EACDC,WAAW,EAAE;IACXC,KAAK,EAAE,MAAOC,UAAU,IAAK;MAC3B,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;QAC7B,MAAMC,uBAAuB,GAC3BH,UAAU,KAAK,QAAQ,GACnBI,+BAAkB,CAACC,WAAW,CAACC,MAAM,GACrCF,+BAAkB,CAACC,WAAW,CAACE,YAAY;QACjD,OAAOH,+BAAkB,CAACL,KAAK,CAACI,uBAAuB,CAAC;MAC1D;;MAEA;MACA,OAAOK,OAAO,CACZ,MAAMnB,4BAA4B,CAACoB,eAAe,GAAGT,UAAU,CACjE,CAAC;IACH;EACF;AACF,CAAC;;AAED;AACA;AACA;AACO,SAASU,kBAAkBA,CAAA,EAAG;EACnC,IAAI,CAACC,MAAM,CAACC,gBAAgB,EAAE;IAC5BD,MAAM,CAACC,gBAAgB,GAAGrB,uBAAuB;EACnD;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_callingx","_callingx2","StreamInCallManagerNativeModule","NativeModules","StreamInCallManager","StreamVideoReactNativeModule","StreamVideoReactNative","CallingxModule","getCallingxLibIfAvailable","shouldBypassForCallKit","isRingingTypeCall","Platform","OS","bypass","isSetup","isOngoingCallsEnabled","streamRNVideoSDKGlobals","callingX","joinCall","joinCallingxCall","endCall","endCallingxCall","registerOutgoingCall","callManager","setup","defaultDevice","setDefaultAudioDeviceEndpointType","start","stop","permissions","check","permission","nativeAndroidPermission","PermissionsAndroid","PERMISSIONS","CAMERA","RECORD_AUDIO","Boolean","checkPermission","registerSDKGlobals","global","streamRNVideoSDK"],"sourceRoot":"../../../../src","sources":["utils/internal/registerSDKGlobals.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAMA,MAAMG,+BAA+B,GAAGC,0BAAa,CAACC,mBAAmB;AACzE,MAAMC,4BAA4B,GAAGF,0BAAa,CAACG,sBAElD;AAED,MAAMC,cAAc,GAAG,IAAAC,mCAAyB,EAAC,CAAC;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAGA,CAAC;EAC9BC;AAGF,CAAC,KAAc;EACb,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,OAAO,KAAK;EACd;EACA,IAAI,CAACL,cAAc,EAAE;IACnB,OAAO,KAAK;EACd;EACA,MAAMM,MAAM,GACVN,cAAc,CAACO,OAAO,KACrBJ,iBAAiB,IAAIH,cAAc,CAACQ,qBAAqB,CAAC;EAC7D,OAAOF,MAAM;AACf,CAAC;AAED,MAAMG,uBAAgD,GAAG;EACvDC,QAAQ,EAAE;IACRC,QAAQ,EAAEC,2BAAgB;IAC1BC,OAAO,EAAEC,0BAAe;IACxBC,oBAAoB,EAAEA;EACxB,CAAC;EACDC,WAAW,EAAE;IACXC,KAAK,EAAEA,CAAC;MAAEC,aAAa;MAAEf;IAAkB,CAAC,KAAK;MAC/C,IAAID,sBAAsB,CAAC;QAAEC;MAAkB,CAAC,CAAC,EAAE;QACjD;MACF;MACAR,+BAA+B,CAACwB,iCAAiC,CAC/DD,aACF,CAAC;MACDvB,+BAA+B,CAACsB,KAAK,CAAC,CAAC;IACzC,CAAC;IACDG,KAAK,EAAEA,CAAC;MAAEjB;IAAkB,CAAC,KAAK;MAChC,IAAID,sBAAsB,CAAC;QAAEC;MAAkB,CAAC,CAAC,EAAE;QACjD;MACF;MACAR,+BAA+B,CAACyB,KAAK,CAAC,CAAC;IACzC,CAAC;IACDC,IAAI,EAAEA,CAAC;MAAElB;IAAkB,CAAC,KAAK;MAC/B,IAAID,sBAAsB,CAAC;QAAEC;MAAkB,CAAC,CAAC,EAAE;QACjD;MACF;MACAR,+BAA+B,CAAC0B,IAAI,CAAC,CAAC;IACxC;EACF,CAAC;EACDC,WAAW,EAAE;IACXC,KAAK,EAAE,MAAOC,UAAU,IAAK;MAC3B,IAAIpB,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;QAC7B,MAAMoB,uBAAuB,GAC3BD,UAAU,KAAK,QAAQ,GACnBE,+BAAkB,CAACC,WAAW,CAACC,MAAM,GACrCF,+BAAkB,CAACC,WAAW,CAACE,YAAY;QACjD,OAAOH,+BAAkB,CAACH,KAAK,CAACE,uBAAuB,CAAC;MAC1D;;MAEA;MACA,OAAOK,OAAO,CACZ,MAAMhC,4BAA4B,CAACiC,eAAe,GAAGP,UAAU,CACjE,CAAC;IACH;EACF;AACF,CAAC;;AAED;AACA;AACA;AACO,SAASQ,kBAAkBA,CAAA,EAAG;EACnC,IAAI,CAACC,MAAM,CAACC,gBAAgB,EAAE;IAC5BD,MAAM,CAACC,gBAAgB,GAAGzB,uBAAuB;EACnD;AACF","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.keepCallAliveCallRef = exports.KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _videoClient = require("@stream-io/video-client");
9
+ var _StreamVideoRN = require("./StreamVideoRN");
10
+ const KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = exports.KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = 'StreamVideoKeepCallAlive';
11
+
12
+ /**
13
+ * The keep-alive headless task needs access to the active `Call` instance.
14
+ * The keep-alive hook will set this reference before starting the native service.
15
+ */
16
+ const keepCallAliveCallRef = exports.keepCallAliveCallRef = {
17
+ current: undefined
18
+ };
19
+ function registerKeepCallAliveHeadlessTaskOnce() {
20
+ if (_reactNative.Platform.OS !== 'android') return;
21
+ _reactNative.AppRegistry.registerHeadlessTask(KEEP_CALL_ALIVE_HEADLESS_TASK_NAME, () => async data => {
22
+ const logger = _videoClient.videoLoggerSystem.getLogger('KEEP_CALL_ALIVE_HEADLESS_TASK');
23
+ const callCid = data?.callCid;
24
+ const call = keepCallAliveCallRef.current;
25
+ if (!call) {
26
+ logger.warn('No active call instance available for keep-alive task; skipping.', {
27
+ callCid
28
+ });
29
+ return;
30
+ }
31
+ if (callCid && call.cid && call.cid !== callCid) {
32
+ logger.warn('Keep-alive task callCid does not match active call; skipping.', {
33
+ callCid,
34
+ activeCallCid: call.cid
35
+ });
36
+ return;
37
+ }
38
+ const config = _StreamVideoRN.StreamVideoRN.getConfig();
39
+ const taskToRun = config.foregroundService.android.taskToRun;
40
+ try {
41
+ await taskToRun(call);
42
+ } catch (e) {
43
+ logger.error('Keep-alive headless task failed', e);
44
+ }
45
+ });
46
+ }
47
+ registerKeepCallAliveHeadlessTaskOnce();
48
+ //# sourceMappingURL=keepCallAliveHeadlessTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_videoClient","_StreamVideoRN","KEEP_CALL_ALIVE_HEADLESS_TASK_NAME","exports","keepCallAliveCallRef","current","undefined","registerKeepCallAliveHeadlessTaskOnce","Platform","OS","AppRegistry","registerHeadlessTask","data","logger","videoLoggerSystem","getLogger","callCid","call","warn","cid","activeCallCid","config","StreamVideoRN","getConfig","taskToRun","foregroundService","android","e","error"],"sourceRoot":"../../../src","sources":["utils/keepCallAliveHeadlessTask.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEO,MAAMG,kCAAkC,GAAAC,OAAA,CAAAD,kCAAA,GAAG,0BAA0B;;AAE5E;AACA;AACA;AACA;AACO,MAAME,oBAAmD,GAAAD,OAAA,CAAAC,oBAAA,GAAG;EACjEC,OAAO,EAAEC;AACX,CAAC;AAED,SAASC,qCAAqCA,CAAA,EAAG;EAC/C,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;EAE/BC,wBAAW,CAACC,oBAAoB,CAC9BT,kCAAkC,EAClC,MAAM,MAAOU,IAAsC,IAAK;IACtD,MAAMC,MAAM,GAAGC,8BAAiB,CAACC,SAAS,CACxC,+BACF,CAAC;IACD,MAAMC,OAAO,GAAGJ,IAAI,EAAEI,OAAO;IAE7B,MAAMC,IAAI,GAAGb,oBAAoB,CAACC,OAAO;IACzC,IAAI,CAACY,IAAI,EAAE;MACTJ,MAAM,CAACK,IAAI,CACT,kEAAkE,EAClE;QAAEF;MAAQ,CACZ,CAAC;MACD;IACF;IACA,IAAIA,OAAO,IAAIC,IAAI,CAACE,GAAG,IAAIF,IAAI,CAACE,GAAG,KAAKH,OAAO,EAAE;MAC/CH,MAAM,CAACK,IAAI,CACT,+DAA+D,EAC/D;QAAEF,OAAO;QAAEI,aAAa,EAAEH,IAAI,CAACE;MAAI,CACrC,CAAC;MACD;IACF;IAEA,MAAME,MAAM,GAAGC,4BAAa,CAACC,SAAS,CAAC,CAAC;IACxC,MAAMC,SAAS,GAAGH,MAAM,CAACI,iBAAiB,CAACC,OAAO,CAACF,SAAS;IAC5D,IAAI;MACF,MAAMA,SAAS,CAACP,IAAI,CAAC;IACvB,CAAC,CAAC,OAAOU,CAAC,EAAE;MACVd,MAAM,CAACe,KAAK,CAAC,iCAAiC,EAAED,CAAC,CAAC;IACpD;EACF,CACF,CAAC;AACH;AAEApB,qCAAqC,CAAC,CAAC","ignoreList":[]}
@@ -13,10 +13,8 @@ var _rxSubjects = require("./internal/rxSubjects");
13
13
  var _constants = require("./internal/constants");
14
14
  var _utils = require("./internal/utils");
15
15
  var _pushLogoutCallback = require("../internal/pushLogoutCallback");
16
- var _getAndroidDefaultRingtoneUrl = require("../getAndroidDefaultRingtoneUrl");
17
16
  var _StreamVideoRN = require("../StreamVideoRN");
18
- const ACCEPT_CALL_ACTION_ID = 'accept';
19
- const DECLINE_CALL_ACTION_ID = 'decline';
17
+ var _callingx = require("./libs/callingx");
20
18
  let lastFirebaseToken = {
21
19
  token: '',
22
20
  userId: ''
@@ -71,8 +69,7 @@ async function initAndroidPushToken(client, pushConfig, setUnsubscribeListener)
71
69
  await setDeviceToken(token);
72
70
  }
73
71
  }
74
- // TODO: remove the incomingCallChannel check and find a better way once we have telecom integration for android
75
- const messaging = pushConfig.isExpo && !pushConfig.android.incomingCallChannel ? (0, _libs.getFirebaseMessagingLibNoThrow)(true) : (0, _libs.getFirebaseMessagingLib)();
72
+ const messaging = pushConfig.isExpo ? (0, _libs.getFirebaseMessagingLibNoThrow)(true) : (0, _libs.getFirebaseMessagingLib)();
76
73
  if (messaging) {
77
74
  logger.debug(`setting firebase token listeners`);
78
75
  const unsubscribe = messaging().onTokenRefresh(refreshedToken => setDeviceToken(refreshedToken));
@@ -86,8 +83,8 @@ async function initAndroidPushToken(client, pushConfig, setUnsubscribeListener)
86
83
  * Creates notification from the push message data.
87
84
  * For Ringing and Non-Ringing calls.
88
85
  */
86
+
89
87
  const firebaseDataHandler = async data => {
90
- if (_reactNative.Platform.OS !== 'android') return;
91
88
  /* Example data from firebase
92
89
  "message": {
93
90
  "data": {
@@ -103,174 +100,155 @@ const firebaseDataHandler = async data => {
103
100
  // other stuff
104
101
  }
105
102
  */
103
+ if (_reactNative.Platform.OS !== 'android') return;
104
+ const logger = _videoClient.videoLoggerSystem.getLogger('firebaseDataHandler');
106
105
  const pushConfig = _StreamVideoRN.StreamVideoRN.getConfig().push;
107
106
  if (!pushConfig || !data || data.sender !== 'stream.video') {
108
107
  return;
109
108
  }
110
- const notifeeLib = (0, _libs.getNotifeeLibThrowIfNotInstalledForPush)();
111
- const notifee = notifeeLib.default;
112
- const settings = await notifee.getNotificationSettings();
113
- if (settings.authorizationStatus !== 1) {
114
- const logger = _videoClient.videoLoggerSystem.getLogger('firebaseDataHandler');
115
- logger.debug(`Notification permission not granted, unable to post ${data.type} notifications`);
116
- return;
117
- }
118
109
  if (data.type === 'call.ring') {
119
110
  const call_cid = data.call_cid;
120
- const created_by_id = data.created_by_id;
121
- const receiver_id = data.receiver_id;
122
- const video_client = await pushConfig.createStreamVideoClient();
123
- await video_client?.onRingingCall(call_cid);
124
- const shouldCallBeClosed = callToCheck => {
125
- const {
126
- mustEndCall
127
- } = (0, _utils.shouldCallBeEnded)(callToCheck, created_by_id, receiver_id);
128
- return mustEndCall;
129
- };
130
- const canListenToWS = () => _utils.canAddPushWSSubscriptionsRef.current && _reactNative.AppState.currentState !== 'active';
131
- const asForegroundService = canListenToWS();
111
+ const callingx = (0, _callingx.getCallingxLib)();
112
+ const client = await pushConfig.createStreamVideoClient();
113
+ if (!client) {
114
+ logger.debug(`video client not found, skipping the call.ring notification`);
115
+ await callingx.stopService();
116
+ return;
117
+ }
118
+ const asForegroundService = (0, _utils.canListenToWS)();
132
119
  if (asForegroundService) {
133
120
  // Listen to call events from WS through fg service
134
121
  // note: this will replace the current empty fg service runner
135
- notifee.registerForegroundService(() => {
136
- return new Promise(async () => {
137
- const client = await pushConfig.createStreamVideoClient();
138
- if (!client) {
139
- _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Closing fg service as there is no client to create from push config`);
140
- notifee.stopForegroundService();
141
- return;
142
- }
143
- const callFromPush = await client.onRingingCall(call_cid);
144
- let _shouldCallBeClosed = shouldCallBeClosed(callFromPush);
145
- if (_shouldCallBeClosed) {
146
- _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Closing fg service callCid: ${call_cid} shouldCallBeClosed: ${_shouldCallBeClosed}`);
147
- notifee.stopForegroundService();
148
- return;
149
- }
150
- const unsubscribeFunctions = [];
151
- // check if service needs to be closed if accept/decline event was done on another device
152
- const unsubscribe = callFromPush.on('all', event => {
153
- const _canListenToWS = canListenToWS();
154
- if (!_canListenToWS) {
155
- _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS}`, {
156
- event
122
+ //we need to start service (e.g. by calling display incoming call) and than launch bg task, consider making those steps independent
123
+ await callingx.startBackgroundTask((_, stopTask) => {
124
+ return new Promise(resolve => {
125
+ const finishBackgroundTask = () => {
126
+ callingx.log(`Finishing background task for callCid: ${call_cid}`, 'debug');
127
+ resolve(undefined);
128
+ stopTask();
129
+ };
130
+ (async () => {
131
+ try {
132
+ const _client = await pushConfig.createStreamVideoClient();
133
+ if (!_client) {
134
+ logger.debug(`Closing fg service as there is no client to create from push config`);
135
+ finishBackgroundTask();
136
+ return;
137
+ }
138
+ const callFromPush = await _client.onRingingCall(call_cid);
139
+ const {
140
+ mustEndCall,
141
+ endCallReason
142
+ } = (0, _utils.shouldCallBeClosed)(callFromPush, data);
143
+ if (mustEndCall) {
144
+ logger.debug(`Closing fg service callCid: ${call_cid} endCallReason: ${endCallReason}`);
145
+ callingx.log(`Ending call with callCid: ${call_cid} endCallReason: ${endCallReason}`, 'debug');
146
+ callingx.endCallWithReason(call_cid, endCallReason);
147
+ resolve(undefined);
148
+ return;
149
+ }
150
+ const unsubscribeFunctions = [];
151
+ // check if service needs to be closed if accept/decline event was done on another device
152
+ const unsubscribe = callFromPush.on('all', event => {
153
+ const _canListenToWS = (0, _utils.canListenToWS)();
154
+ if (!_canListenToWS) {
155
+ logger.debug(`Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS}`, {
156
+ event
157
+ });
158
+ unsubscribeFunctions.forEach(fn => fn());
159
+ finishBackgroundTask();
160
+ return;
161
+ }
162
+ const {
163
+ mustEndCall: mustEndCallFromEvent,
164
+ endCallReason: endCallReasonFromEvent
165
+ } = (0, _utils.shouldCallBeClosed)(callFromPush, data);
166
+ if (mustEndCallFromEvent) {
167
+ logger.debug(`Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS} shouldCallBeClosed`, {
168
+ event
169
+ });
170
+ unsubscribeFunctions.forEach(fn => fn());
171
+ callingx.endCallWithReason(call_cid, endCallReasonFromEvent);
172
+ resolve(undefined);
173
+ }
157
174
  });
158
- unsubscribeFunctions.forEach(fn => fn());
159
- notifee.stopForegroundService();
160
- return;
161
- }
162
- _shouldCallBeClosed = shouldCallBeClosed(callFromPush);
163
- if (_shouldCallBeClosed) {
164
- _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS} shouldCallBeClosed: ${_shouldCallBeClosed}`, {
165
- event
175
+
176
+ // check if service needs to be closed if call was left
177
+ const stateSubscription = callFromPush.state.callingState$.subscribe(callingState => {
178
+ if (callingState === _videoClient.CallingState.IDLE || callingState === _videoClient.CallingState.LEFT) {
179
+ logger.debug(`Closing fg service from callingState callCid: ${call_cid} callingState: ${callingState}`);
180
+ unsubscribeFunctions.forEach(fn => fn());
181
+ callingx.log(`Ending call with callCid: ${call_cid} callingState: ${callingState}`, 'debug');
182
+ resolve(undefined);
183
+ }
166
184
  });
167
- unsubscribeFunctions.forEach(fn => fn());
168
- notifee.stopForegroundService();
169
- }
170
- });
171
- // check if service needs to be closed if call was left
172
- const subscription = callFromPush.state.callingState$.subscribe(callingState => {
173
- if (callingState === _videoClient.CallingState.IDLE || callingState === _videoClient.CallingState.LEFT) {
174
- _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Closing fg service from callingState callCid: ${call_cid} callingState: ${callingState}`);
175
- unsubscribeFunctions.forEach(fn => fn());
176
- notifee.stopForegroundService();
185
+ const endCallSubscription = callingx.addEventListener('endCall', async ({
186
+ callId
187
+ }) => {
188
+ unsubscribeFunctions.forEach(fn => fn());
189
+ try {
190
+ await callFromPush.leave({
191
+ reject: callFromPush.state.callingState === _videoClient.CallingState.RINGING,
192
+ reason: 'decline'
193
+ });
194
+ } catch (error) {
195
+ logger.error(`Failed to leave call with callCid: ${call_cid} error: ${error}`);
196
+ } finally {
197
+ callingx.log(`Ending call with callCid: ${call_cid} callId: ${callId}`, 'debug');
198
+ resolve(undefined);
199
+ }
200
+ });
201
+
202
+ //stop background task when app comes to foreground
203
+ const appStateSubscription = _reactNative.AppState.addEventListener('change', nextAppState => {
204
+ const _canListenToWS = (0, _utils.canListenToWS)();
205
+ callingx.log(`AppState changed to: ${nextAppState} for callCid: ${call_cid} canListenToWS: ${_canListenToWS}`, 'debug');
206
+ if (!_canListenToWS) {
207
+ unsubscribeFunctions.forEach(fn => fn());
208
+ finishBackgroundTask();
209
+ return;
210
+ }
211
+ });
212
+ unsubscribeFunctions.push(unsubscribe);
213
+ unsubscribeFunctions.push(() => stateSubscription.unsubscribe());
214
+ unsubscribeFunctions.push(() => endCallSubscription.remove());
215
+ unsubscribeFunctions.push(() => appStateSubscription.remove());
216
+ _constants.pushUnsubscriptionCallbacks.get(call_cid)?.forEach(cb => cb());
217
+ _constants.pushUnsubscriptionCallbacks.set(call_cid, unsubscribeFunctions);
218
+ } catch (error) {
219
+ callingx.log(`Failed to start background task with callCid: ${call_cid} error: ${error}`, 'error');
220
+ finishBackgroundTask();
177
221
  }
178
- });
179
- unsubscribeFunctions.push(unsubscribe);
180
- unsubscribeFunctions.push(() => subscription.unsubscribe());
181
- _constants.pushUnsubscriptionCallbacks.get(call_cid)?.forEach(cb => cb());
182
- _constants.pushUnsubscriptionCallbacks.set(call_cid, unsubscribeFunctions);
222
+ })();
183
223
  });
184
224
  });
185
225
  }
186
- const incomingCallChannel = pushConfig.android.incomingCallChannel;
187
- const incomingCallNotificationTextGetters = pushConfig.android.incomingCallNotificationTextGetters;
188
- if (!incomingCallChannel || !incomingCallNotificationTextGetters) {
189
- const logger = _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler');
190
- logger.error("Can't show incoming call notification as either or both incomingCallChannel and incomingCallNotificationTextGetters were not provided");
191
- return;
192
- }
193
- /*
194
- * Sound has to be set on channel level for android 8 and above and cant be updated later after creation!
195
- * For android 7 and below, sound should be set on notification level
196
- */
197
- // set default ringtone if not provided
198
- if (!incomingCallChannel.sound) {
199
- incomingCallChannel.sound = await (0, _getAndroidDefaultRingtoneUrl.getAndroidDefaultRingtoneUrl)();
200
- }
201
- await notifee.createChannel(incomingCallChannel);
202
- const {
203
- getTitle,
204
- getBody,
205
- getAcceptButtonTitle,
206
- getDeclineButtonTitle
207
- } = incomingCallNotificationTextGetters;
208
- const createdUserName = data.created_by_display_name;
209
- const title = getTitle(createdUserName);
210
- const body = getBody(createdUserName);
211
- _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Displaying incoming call notification with callCid: ${call_cid} title: ${title} body: ${body} asForegroundService: ${asForegroundService}`);
212
- const channelId = incomingCallChannel.id;
213
- await notifee.displayNotification({
214
- id: call_cid,
215
- title: getTitle(createdUserName),
216
- body: getBody(createdUserName),
217
- data,
218
- android: {
219
- channelId,
220
- smallIcon: pushConfig.android.smallIcon,
221
- importance: 4,
222
- // high importance
223
- foregroundServiceTypes: (0, _libs.getIncomingCallForegroundServiceTypes)(),
224
- asForegroundService,
225
- ongoing: true,
226
- sound: incomingCallChannel.sound,
227
- vibrationPattern: incomingCallChannel.vibrationPattern,
228
- loopSound: true,
229
- pressAction: {
230
- id: 'default',
231
- launchActivity: 'default' // open the app when the notification is pressed
232
- },
233
- actions: [{
234
- title: getDeclineButtonTitle?.() ?? 'Decline',
235
- pressAction: {
236
- id: DECLINE_CALL_ACTION_ID
237
- }
238
- }, {
239
- title: getAcceptButtonTitle?.() ?? 'Accept',
240
- pressAction: {
241
- id: ACCEPT_CALL_ACTION_ID,
242
- launchActivity: 'default' // open the app when the notification is pressed
243
- }
244
- }],
245
- category: notifeeLib.AndroidCategory.CALL,
246
- fullScreenAction: {
247
- id: 'stream_ringing_incoming_call'
248
- },
249
- timeoutAfter: 60000 // 60 seconds, after which the notification will be dismissed automatically
250
- }
251
- });
252
226
  if (asForegroundService) {
253
227
  // no need to check if call has be closed as that will be handled by the fg service
254
228
  return;
255
229
  }
256
-
257
- // check if call needs to be closed if accept/decline event was done
258
- // before the notification was shown
259
- const client = await pushConfig.createStreamVideoClient();
260
- if (!client) {
261
- return;
262
- }
263
230
  const callFromPush = await client.onRingingCall(call_cid);
264
- if (shouldCallBeClosed(callFromPush)) {
265
- _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Removing incoming call notification immediately with callCid: ${call_cid} as it should be closed`);
266
- notifee.cancelDisplayedNotification(call_cid);
231
+ const {
232
+ mustEndCall,
233
+ endCallReason
234
+ } = (0, _utils.shouldCallBeClosed)(callFromPush, data);
235
+ if (mustEndCall) {
236
+ logger.debug(`Removing incoming call notification immediately with callCid: ${call_cid} as it should be closed`);
237
+ callingx.endCallWithReason(call_cid, endCallReason);
267
238
  }
268
239
  } else {
240
+ const notifeeLib = (0, _libs.getNotifeeLibThrowIfNotInstalledForPush)();
241
+ const notifee = notifeeLib.default;
242
+ const settings = await notifee.getNotificationSettings();
243
+ if (settings.authorizationStatus !== 1) {
244
+ logger.debug(`Notification permission not granted, unable to post ${data.type} notifications`);
245
+ return;
246
+ }
247
+
269
248
  // the other types are call.live_started and call.notification
270
249
  const callChannel = pushConfig.android.callChannel;
271
250
  const callNotificationTextGetters = pushConfig.android.callNotificationTextGetters;
272
251
  if (!callChannel || !callNotificationTextGetters) {
273
- const logger = _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler');
274
252
  logger.debug("Can't show call notification as either or both callChannel and callNotificationTextGetters is not provided");
275
253
  return;
276
254
  }
@@ -285,10 +263,10 @@ const firebaseDataHandler = async data => {
285
263
  const type = data.type;
286
264
  const title = getTitle(type, createdUserName);
287
265
  const body = getBody(type, createdUserName);
288
- _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Displaying NonRingingPushEvent ${type} notification with title: ${title} body: ${body}`);
266
+ logger.debug(`Displaying NonRingingPushEvent ${type} notification with title: ${title} body: ${body}`);
289
267
  await notifee.displayNotification({
290
- title: getTitle(type, createdUserName),
291
- body: getBody(type, createdUserName),
268
+ title,
269
+ body,
292
270
  data,
293
271
  android: {
294
272
  sound: callChannel.sound,
@@ -313,8 +291,7 @@ const firebaseDataHandler = async data => {
313
291
  };
314
292
  exports.firebaseDataHandler = firebaseDataHandler;
315
293
  const onAndroidNotifeeEvent = async ({
316
- event,
317
- isBackground
294
+ event
318
295
  }) => {
319
296
  if (_reactNative.Platform.OS !== 'android') return;
320
297
  const {
@@ -322,8 +299,7 @@ const onAndroidNotifeeEvent = async ({
322
299
  detail
323
300
  } = event;
324
301
  const {
325
- notification,
326
- pressAction
302
+ notification
327
303
  } = detail;
328
304
  const notificationId = notification?.id;
329
305
  const data = notification?.data;
@@ -334,53 +310,10 @@ const onAndroidNotifeeEvent = async ({
334
310
 
335
311
  // we can safely cast to string because the data is from "stream.video"
336
312
  const call_cid = data.call_cid;
337
- if (data.type === 'call.ring') {
338
- // check if we have observers for the call cid (this means the app is in the foreground state)
339
- const hasObservers = _rxSubjects.pushAcceptedIncomingCallCId$.observed && _rxSubjects.pushRejectedIncomingCallCId$.observed;
340
- const notifeeLib = (0, _libs.getNotifeeLibThrowIfNotInstalledForPush)();
341
- const notifee = notifeeLib.default;
342
- // Check if we need to decline the call
343
- const didPressDecline = type === notifeeLib.EventType.ACTION_PRESS && pressAction?.id === DECLINE_CALL_ACTION_ID;
344
- const didDismiss = type === notifeeLib.EventType.DISMISSED;
345
- const mustDecline = didPressDecline || didDismiss;
346
- // Check if we need to accept the call
347
- const mustAccept = type === notifeeLib.EventType.ACTION_PRESS && pressAction?.id === ACCEPT_CALL_ACTION_ID;
348
- if (mustAccept || mustDecline || type === notifeeLib.EventType.ACTION_PRESS) {
349
- _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`clearPushWSEventSubscriptions for callCId: ${call_cid} mustAccept: ${mustAccept} mustDecline: ${mustDecline}`);
350
- (0, _utils.clearPushWSEventSubscriptions)(call_cid);
351
- notifee.stopForegroundService();
352
- }
353
- if (mustAccept) {
354
- _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`pushAcceptedIncomingCallCId$ added with callCId: ${call_cid}`);
355
- _rxSubjects.pushAcceptedIncomingCallCId$.next(call_cid);
356
- // NOTE: accept will be handled by the app with rxjs observers as the app will go to foreground always
357
- } else if (mustDecline) {
358
- _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`pushRejectedIncomingCallCId$ added with callCId: ${call_cid}`);
359
- _rxSubjects.pushRejectedIncomingCallCId$.next(call_cid);
360
- if (hasObservers) {
361
- // if we had observers we can return here as the observers will handle the call as the app is in the foreground state
362
- _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`Skipped processCallFromPushInBackground for Declining call with callCId: ${call_cid} as the app is in the foreground state`);
363
- return;
364
- }
365
- _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`start processCallFromPushInBackground - Declining call with callCId: ${call_cid}`);
366
- await (0, _utils.processCallFromPushInBackground)(pushConfig, call_cid, 'decline');
367
- } else {
368
- if (type === notifeeLib.EventType.PRESS) {
369
- _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`pushTappedIncomingCallCId$ added with callCId: ${call_cid}`);
370
- _rxSubjects.pushTappedIncomingCallCId$.next(call_cid);
371
- // pressed state will be handled by the app with rxjs observers as the app will go to foreground always
372
- } else if (isBackground && type === notifeeLib.EventType.DELIVERED) {
373
- _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`pushAndroidBackgroundDeliveredIncomingCallCId$ added with callCId: ${call_cid}`);
374
- _rxSubjects.pushAndroidBackgroundDeliveredIncomingCallCId$.next(call_cid);
375
- // background delivered state will be handled by the app with rxjs observers as processing needs to happen only when app is opened
376
- }
377
- }
378
- } else {
379
- const notifeeLib = (0, _libs.getNotifeeLibThrowIfNotInstalledForPush)();
380
- if (type === notifeeLib.EventType.PRESS) {
381
- _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`onTapNonRingingCallNotification with callCId: ${call_cid}`);
382
- pushConfig.onTapNonRingingCallNotification?.(call_cid, data.type);
383
- }
313
+ const notifeeLib = (0, _libs.getNotifeeLibThrowIfNotInstalledForPush)();
314
+ if (type === notifeeLib.EventType.PRESS) {
315
+ _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`onTapNonRingingCallNotification with callCId: ${call_cid}`);
316
+ pushConfig.onTapNonRingingCallNotification?.(call_cid, data.type);
384
317
  }
385
318
  };
386
319
  exports.onAndroidNotifeeEvent = onAndroidNotifeeEvent;
@@ -1 +1 @@
1
- {"version":3,"names":["_videoClient","require","_reactNative","_libs","_rxSubjects","_constants","_utils","_pushLogoutCallback","_getAndroidDefaultRingtoneUrl","_StreamVideoRN","ACCEPT_CALL_ACTION_ID","DECLINE_CALL_ACTION_ID","lastFirebaseToken","token","userId","initAndroidPushToken","client","pushConfig","setUnsubscribeListener","Platform","OS","android","pushProviderName","logger","videoLoggerSystem","getLogger","setDeviceToken","streamClient","_user","id","anonymous","debug","setPushLogoutCallback","removeDevice","err","warn","push_provider_name","addDevice","isExpo","expoNotificationsLib","onTapNonRingingCallNotification","getExpoNotificationsLib","getExpoNotificationsLibNoThrow","subscription","addPushTokenListener","devicePushToken","data","remove","getDevicePushTokenAsync","messaging","incomingCallChannel","getFirebaseMessagingLibNoThrow","getFirebaseMessagingLib","unsubscribe","onTokenRefresh","refreshedToken","getToken","firebaseDataHandler","StreamVideoRN","getConfig","push","sender","notifeeLib","getNotifeeLibThrowIfNotInstalledForPush","notifee","default","settings","getNotificationSettings","authorizationStatus","type","call_cid","created_by_id","receiver_id","video_client","createStreamVideoClient","onRingingCall","shouldCallBeClosed","callToCheck","mustEndCall","shouldCallBeEnded","canListenToWS","canAddPushWSSubscriptionsRef","current","AppState","currentState","asForegroundService","registerForegroundService","Promise","stopForegroundService","callFromPush","_shouldCallBeClosed","unsubscribeFunctions","on","event","_canListenToWS","forEach","fn","state","callingState$","subscribe","callingState","CallingState","IDLE","LEFT","pushUnsubscriptionCallbacks","get","cb","set","incomingCallNotificationTextGetters","error","sound","getAndroidDefaultRingtoneUrl","createChannel","getTitle","getBody","getAcceptButtonTitle","getDeclineButtonTitle","createdUserName","created_by_display_name","title","body","channelId","displayNotification","smallIcon","importance","foregroundServiceTypes","getIncomingCallForegroundServiceTypes","ongoing","vibrationPattern","loopSound","pressAction","launchActivity","actions","category","AndroidCategory","CALL","fullScreenAction","timeoutAfter","cancelDisplayedNotification","callChannel","callNotificationTextGetters","cid","pushNonRingingCallData$","next","exports","onAndroidNotifeeEvent","isBackground","detail","notification","notificationId","hasObservers","pushAcceptedIncomingCallCId$","observed","pushRejectedIncomingCallCId$","didPressDecline","EventType","ACTION_PRESS","didDismiss","DISMISSED","mustDecline","mustAccept","clearPushWSEventSubscriptions","processCallFromPushInBackground","PRESS","pushTappedIncomingCallCId$","DELIVERED","pushAndroidBackgroundDeliveredIncomingCallCId$"],"sourceRoot":"../../../../src","sources":["utils/push/android.ts"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AAUA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAMA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,6BAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAEA,MAAMS,qBAAqB,GAAG,QAAQ;AACtC,MAAMC,sBAAsB,GAAG,SAAS;AAUxC,IAAIC,iBAAiB,GAAG;EAAEC,KAAK,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;;AAEjD;AACO,e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,IAAID,IAAI,KAAKP,UAAU,CAAC6F,SAAS,CAACQ,KAAK,EAAE;QACvC3I,8BAAiB,CACdC,SAAS,CAAC,uBAAuB,CAAC,CAClCM,KAAK,CAAC,kDAAkDuC,QAAQ,EAAE,CAAC;QACtE8F,sCAA0B,CAACrB,IAAI,CAACzE,QAAQ,CAAC;QACzC;MACF,CAAC,MAAM,IAAI4E,YAAY,IAAI7E,IAAI,KAAKP,UAAU,CAAC6F,SAAS,CAACU,SAAS,EAAE;QAClE7I,8BAAiB,CACdC,SAAS,CAAC,uBAAuB,CAAC,CAClCM,KAAK,CACJ,sEAAsEuC,QAAQ,EAChF,CAAC;QACHgG,0DAA8C,CAACvB,IAAI,CAACzE,QAAQ,CAAC;QAC7D;MACF;IACF;EACF,CAAC,MAAM;IACL,MAAMR,UAAU,GAAG,IAAAC,6CAAuC,EAAC,CAAC;IAC5D,IAAIM,IAAI,KAAKP,UAAU,CAAC6F,SAAS,CAACQ,KAAK,EAAE;MACvC3I,8BAAiB,CACdC,SAAS,CAAC,uBAAuB,CAAC,CAClCM,KAAK,CAAC,iDAAiDuC,QAAQ,EAAE,CAAC;MACrErD,UAAU,CAACuB,+BAA+B,GACxC8B,QAAQ,EACRxB,IAAI,CAACuB,IACP,CAAC;IACH;EACF;AACF,CAAC;AAAC2E,OAAA,CAAAC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_videoClient","require","_reactNative","_libs","_rxSubjects","_constants","_utils","_pushLogoutCallback","_StreamVideoRN","_callingx","lastFirebaseToken","token","userId","initAndroidPushToken","client","pushConfig","setUnsubscribeListener","Platform","OS","android","pushProviderName","logger","videoLoggerSystem","getLogger","setDeviceToken","streamClient","_user","id","anonymous","debug","setPushLogoutCallback","removeDevice","err","warn","push_provider_name","addDevice","isExpo","expoNotificationsLib","onTapNonRingingCallNotification","getExpoNotificationsLib","getExpoNotificationsLibNoThrow","subscription","addPushTokenListener","devicePushToken","data","remove","getDevicePushTokenAsync","messaging","getFirebaseMessagingLibNoThrow","getFirebaseMessagingLib","unsubscribe","onTokenRefresh","refreshedToken","getToken","firebaseDataHandler","StreamVideoRN","getConfig","push","sender","type","call_cid","callingx","getCallingxLib","createStreamVideoClient","stopService","asForegroundService","canListenToWS","startBackgroundTask","_","stopTask","Promise","resolve","finishBackgroundTask","log","undefined","_client","callFromPush","onRingingCall","mustEndCall","endCallReason","shouldCallBeClosed","endCallWithReason","unsubscribeFunctions","on","event","_canListenToWS","forEach","fn","mustEndCallFromEvent","endCallReasonFromEvent","stateSubscription","state","callingState$","subscribe","callingState","CallingState","IDLE","LEFT","endCallSubscription","addEventListener","callId","leave","reject","RINGING","reason","error","appStateSubscription","AppState","nextAppState","pushUnsubscriptionCallbacks","get","cb","set","notifeeLib","getNotifeeLibThrowIfNotInstalledForPush","notifee","default","settings","getNotificationSettings","authorizationStatus","callChannel","callNotificationTextGetters","createChannel","channelId","getTitle","getBody","createdUserName","created_by_display_name","title","body","displayNotification","sound","smallIcon","vibrationPattern","importance","pressAction","launchActivity","timeoutAfter","cid","pushNonRingingCallData$","next","exports","onAndroidNotifeeEvent","detail","notification","notificationId","EventType","PRESS"],"sourceRoot":"../../../../src","sources":["utils/push/android.ts"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AASA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAUA,IAAIS,iBAAiB,GAAG;EAAEC,KAAK,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;;AAEjD;AACO,eAAeC,oBAAoBA,CACxCC,MAAyB,EACzBC,UAAsB,EACtBC,sBAAyD,EACzD;EACA,IAA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