@stream-io/video-react-native-sdk 1.29.4-beta.0 → 1.30.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 (276) hide show
  1. package/CHANGELOG.md +3162 -0
  2. package/android/src/main/AndroidManifest.xml +1 -8
  3. package/android/src/main/AndroidManifestNew.xml +0 -11
  4. package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +5 -42
  5. package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +6 -70
  6. package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +4 -6
  7. package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +95 -0
  8. package/dist/commonjs/components/Call/CallContent/CallContent.js +13 -7
  9. package/dist/commonjs/components/Call/CallContent/CallContent.js.map +1 -1
  10. package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js +50 -14
  11. package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
  12. package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js +27 -0
  13. package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
  14. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js +19 -10
  15. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  16. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js +12 -9
  17. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  18. package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js +19 -4
  19. package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
  20. package/dist/commonjs/hooks/push/index.js +2 -0
  21. package/dist/commonjs/hooks/push/index.js.map +1 -1
  22. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +160 -0
  23. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
  24. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
  25. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  26. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +67 -0
  27. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +1 -0
  28. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +97 -64
  29. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  30. package/dist/commonjs/index.js +0 -1
  31. package/dist/commonjs/index.js.map +1 -1
  32. package/dist/commonjs/modules/call-manager/CallManager.js +0 -26
  33. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  34. package/dist/commonjs/providers/StreamCall/index.js +6 -6
  35. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  36. package/dist/commonjs/utils/StreamVideoRN/index.js +21 -33
  37. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  38. package/dist/commonjs/utils/hooks/index.js +0 -11
  39. package/dist/commonjs/utils/hooks/index.js.map +1 -1
  40. package/dist/commonjs/utils/internal/registerSDKGlobals.js +3 -52
  41. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  42. package/dist/commonjs/utils/push/android.js +202 -151
  43. package/dist/commonjs/utils/push/android.js.map +1 -1
  44. package/dist/commonjs/utils/push/internal/ios.js +34 -17
  45. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  46. package/dist/commonjs/utils/push/internal/rxSubjects.js +45 -1
  47. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  48. package/dist/commonjs/utils/push/internal/utils.js +20 -32
  49. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  50. package/dist/commonjs/utils/push/ios.js.map +1 -1
  51. package/dist/commonjs/utils/push/libs/callkeep.js +17 -0
  52. package/dist/commonjs/utils/push/libs/callkeep.js.map +1 -0
  53. package/dist/commonjs/utils/push/libs/index.js +19 -8
  54. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  55. package/dist/commonjs/utils/push/libs/notifee/index.js +19 -0
  56. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  57. package/dist/commonjs/utils/push/libs/voipPushNotification.js +17 -0
  58. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +1 -0
  59. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +205 -0
  60. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +1 -0
  61. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +6 -7
  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/CallContent/CallContent.js +10 -4
  66. package/dist/module/components/Call/CallContent/CallContent.js.map +1 -1
  67. package/dist/module/components/Call/CallContent/RTCViewPipIOS.js +52 -16
  68. package/dist/module/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
  69. package/dist/module/components/Call/CallContent/RTCViewPipNative.js +27 -0
  70. package/dist/module/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
  71. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js +19 -10
  72. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  73. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js +15 -12
  74. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  75. package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js +20 -5
  76. package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
  77. package/dist/module/hooks/push/index.js +2 -0
  78. package/dist/module/hooks/push/index.js.map +1 -1
  79. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +153 -0
  80. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
  81. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
  82. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  83. package/dist/module/hooks/push/useProcessPushCallEffect.js +60 -0
  84. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +1 -0
  85. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +99 -66
  86. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  87. package/dist/module/index.js +0 -1
  88. package/dist/module/index.js.map +1 -1
  89. package/dist/module/modules/call-manager/CallManager.js +0 -26
  90. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  91. package/dist/module/providers/StreamCall/index.js +6 -6
  92. package/dist/module/providers/StreamCall/index.js.map +1 -1
  93. package/dist/module/utils/StreamVideoRN/index.js +21 -33
  94. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  95. package/dist/module/utils/hooks/index.js +0 -1
  96. package/dist/module/utils/hooks/index.js.map +1 -1
  97. package/dist/module/utils/internal/registerSDKGlobals.js +3 -52
  98. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  99. package/dist/module/utils/push/android.js +204 -153
  100. package/dist/module/utils/push/android.js.map +1 -1
  101. package/dist/module/utils/push/internal/ios.js +34 -17
  102. package/dist/module/utils/push/internal/ios.js.map +1 -1
  103. package/dist/module/utils/push/internal/rxSubjects.js +44 -0
  104. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  105. package/dist/module/utils/push/internal/utils.js +19 -29
  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/callkeep.js +11 -0
  109. package/dist/module/utils/push/libs/callkeep.js.map +1 -0
  110. package/dist/module/utils/push/libs/index.js +2 -1
  111. package/dist/module/utils/push/libs/index.js.map +1 -1
  112. package/dist/module/utils/push/libs/notifee/index.js +18 -0
  113. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  114. package/dist/module/utils/push/libs/voipPushNotification.js +11 -0
  115. package/dist/module/utils/push/libs/voipPushNotification.js.map +1 -0
  116. package/dist/module/utils/push/setupIosCallKeepEvents.js +199 -0
  117. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +1 -0
  118. package/dist/module/utils/push/setupIosVoipPushEvents.js +6 -7
  119. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  120. package/dist/module/version.js +1 -1
  121. package/dist/module/version.js.map +1 -1
  122. package/dist/typescript/components/Call/CallContent/CallContent.d.ts.map +1 -1
  123. package/dist/typescript/components/Call/CallContent/RTCViewPipIOS.d.ts.map +1 -1
  124. package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts +18 -0
  125. package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts.map +1 -1
  126. package/dist/typescript/components/Call/CallLayout/CallParticipantsGrid.d.ts.map +1 -1
  127. package/dist/typescript/components/Call/CallLayout/CallParticipantsSpotlight.d.ts.map +1 -1
  128. package/dist/typescript/components/Call/CallParticipantsList/CallParticipantsList.d.ts.map +1 -1
  129. package/dist/typescript/hooks/push/index.d.ts.map +1 -1
  130. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +5 -0
  131. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +1 -0
  132. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  133. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +8 -0
  134. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +1 -0
  135. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  136. package/dist/typescript/index.d.ts +0 -1
  137. package/dist/typescript/index.d.ts.map +1 -1
  138. package/dist/typescript/modules/call-manager/CallManager.d.ts +0 -5
  139. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  140. package/dist/typescript/utils/StreamVideoRN/index.d.ts +2 -20
  141. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  142. package/dist/typescript/utils/StreamVideoRN/types.d.ts +29 -54
  143. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  144. package/dist/typescript/utils/hooks/index.d.ts +0 -1
  145. package/dist/typescript/utils/hooks/index.d.ts.map +1 -1
  146. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  147. package/dist/typescript/utils/push/android.d.ts +2 -1
  148. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  149. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  150. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +33 -0
  151. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  152. package/dist/typescript/utils/push/internal/utils.d.ts +1 -8
  153. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  154. package/dist/typescript/utils/push/ios.d.ts +2 -1
  155. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  156. package/dist/typescript/utils/push/libs/callkeep.d.ts +3 -0
  157. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +1 -0
  158. package/dist/typescript/utils/push/libs/index.d.ts +2 -1
  159. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  160. package/dist/typescript/utils/push/libs/notifee/index.d.ts +1 -0
  161. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  162. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +3 -0
  163. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +1 -0
  164. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +6 -0
  165. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +1 -0
  166. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  167. package/dist/typescript/version.d.ts +1 -1
  168. package/dist/typescript/version.d.ts.map +1 -1
  169. package/expo-config-plugin/dist/withAndroidManifest.js +33 -1
  170. package/expo-config-plugin/dist/withAndroidPermissions.js +7 -2
  171. package/expo-config-plugin/dist/withAppDelegate.js +197 -19
  172. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  173. package/expo-config-plugin/dist/withiOSInfoPlist.js +3 -2
  174. package/ios/PictureInPicture/PictureInPictureAvatarView.swift +273 -0
  175. package/ios/PictureInPicture/PictureInPictureConnectionQualityIndicator.swift +162 -0
  176. package/ios/PictureInPicture/PictureInPictureContent.swift +173 -0
  177. package/ios/PictureInPicture/PictureInPictureContentState.swift +123 -0
  178. package/ios/PictureInPicture/PictureInPictureDelegateProxy.swift +89 -0
  179. package/ios/PictureInPicture/PictureInPictureEnforcedStopAdapter.swift +166 -0
  180. package/ios/PictureInPicture/PictureInPictureLogger.swift +16 -0
  181. package/ios/PictureInPicture/PictureInPictureParticipantOverlayView.swift +217 -0
  182. package/ios/PictureInPicture/PictureInPictureReconnectionView.swift +193 -0
  183. package/ios/PictureInPicture/StreamAVPictureInPictureVideoCallViewController.swift +125 -7
  184. package/ios/PictureInPicture/StreamPictureInPictureController.swift +237 -63
  185. package/ios/PictureInPicture/StreamPictureInPictureControllerProtocol.swift +30 -0
  186. package/ios/PictureInPicture/StreamPictureInPictureVideoRenderer.swift +384 -12
  187. package/ios/RTCViewPip.swift +187 -21
  188. package/ios/RTCViewPipManager.mm +9 -0
  189. package/ios/RTCViewPipManager.swift +3 -3
  190. package/ios/StreamInCallManager.m +0 -2
  191. package/ios/StreamInCallManager.swift +7 -19
  192. package/ios/StreamVideoReactNative.h +4 -7
  193. package/ios/StreamVideoReactNative.m +82 -189
  194. package/package.json +19 -14
  195. package/src/components/Call/CallContent/CallContent.tsx +16 -8
  196. package/src/components/Call/CallContent/RTCViewPipIOS.tsx +81 -15
  197. package/src/components/Call/CallContent/RTCViewPipNative.tsx +36 -0
  198. package/src/components/Call/CallLayout/CallParticipantsGrid.tsx +28 -14
  199. package/src/components/Call/CallLayout/CallParticipantsSpotlight.tsx +19 -10
  200. package/src/components/Call/CallParticipantsList/CallParticipantsList.tsx +20 -5
  201. package/src/hooks/push/index.ts +2 -0
  202. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +235 -0
  203. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +34 -21
  204. package/src/hooks/push/useProcessPushCallEffect.ts +108 -0
  205. package/src/hooks/useAndroidKeepCallAliveEffect.ts +120 -94
  206. package/src/index.ts +0 -1
  207. package/src/modules/call-manager/CallManager.ts +0 -36
  208. package/src/modules/call-manager/native-module.d.ts +0 -7
  209. package/src/providers/StreamCall/index.tsx +6 -6
  210. package/src/utils/StreamVideoRN/index.ts +30 -40
  211. package/src/utils/StreamVideoRN/types.ts +29 -56
  212. package/src/utils/hooks/index.ts +0 -1
  213. package/src/utils/internal/registerSDKGlobals.ts +4 -47
  214. package/src/utils/push/android.ts +309 -227
  215. package/src/utils/push/internal/ios.ts +44 -28
  216. package/src/utils/push/internal/rxSubjects.ts +61 -0
  217. package/src/utils/push/internal/utils.ts +26 -45
  218. package/src/utils/push/ios.ts +6 -1
  219. package/src/utils/push/libs/callkeep.ts +16 -0
  220. package/src/utils/push/libs/index.ts +2 -1
  221. package/src/utils/push/libs/notifee/index.ts +27 -0
  222. package/src/utils/push/libs/voipPushNotification.ts +17 -0
  223. package/src/utils/push/setupIosCallKeepEvents.ts +252 -0
  224. package/src/utils/push/setupIosVoipPushEvents.ts +7 -11
  225. package/src/version.ts +1 -1
  226. package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +0 -83
  227. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +0 -149
  228. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +0 -121
  229. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
  230. package/dist/commonjs/utils/hooks/useDebouncedValue.js +0 -24
  231. package/dist/commonjs/utils/hooks/useDebouncedValue.js.map +0 -1
  232. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +0 -58
  233. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +0 -1
  234. package/dist/commonjs/utils/internal/callingx/callingx.js +0 -109
  235. package/dist/commonjs/utils/internal/callingx/callingx.js.map +0 -1
  236. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +0 -48
  237. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +0 -1
  238. package/dist/commonjs/utils/push/libs/callingx.js +0 -75
  239. package/dist/commonjs/utils/push/libs/callingx.js.map +0 -1
  240. package/dist/commonjs/utils/push/setupCallingExpEvents.js +0 -108
  241. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +0 -1
  242. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +0 -114
  243. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
  244. package/dist/module/utils/hooks/useDebouncedValue.js +0 -19
  245. package/dist/module/utils/hooks/useDebouncedValue.js.map +0 -1
  246. package/dist/module/utils/internal/callingx/audioSessionPromise.js +0 -51
  247. package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +0 -1
  248. package/dist/module/utils/internal/callingx/callingx.js +0 -100
  249. package/dist/module/utils/internal/callingx/callingx.js.map +0 -1
  250. package/dist/module/utils/keepCallAliveHeadlessTask.js +0 -42
  251. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +0 -1
  252. package/dist/module/utils/push/libs/callingx.js +0 -67
  253. package/dist/module/utils/push/libs/callingx.js.map +0 -1
  254. package/dist/module/utils/push/setupCallingExpEvents.js +0 -102
  255. package/dist/module/utils/push/setupCallingExpEvents.js.map +0 -1
  256. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +0 -5
  257. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +0 -1
  258. package/dist/typescript/utils/hooks/useDebouncedValue.d.ts +0 -8
  259. package/dist/typescript/utils/hooks/useDebouncedValue.d.ts.map +0 -1
  260. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +0 -16
  261. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +0 -1
  262. package/dist/typescript/utils/internal/callingx/callingx.d.ts +0 -14
  263. package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +0 -1
  264. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +0 -10
  265. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +0 -1
  266. package/dist/typescript/utils/push/libs/callingx.d.ts +0 -9
  267. package/dist/typescript/utils/push/libs/callingx.d.ts.map +0 -1
  268. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +0 -8
  269. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +0 -1
  270. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +0 -147
  271. package/src/utils/hooks/useDebouncedValue.ts +0 -21
  272. package/src/utils/internal/callingx/audioSessionPromise.ts +0 -53
  273. package/src/utils/internal/callingx/callingx.ts +0 -146
  274. package/src/utils/keepCallAliveHeadlessTask.ts +0 -54
  275. package/src/utils/push/libs/callingx.ts +0 -90
  276. package/src/utils/push/setupCallingExpEvents.ts +0 -130
@@ -13,8 +13,10 @@ 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");
16
17
  var _StreamVideoRN = require("../StreamVideoRN");
17
- var _callingx = require("./libs/callingx");
18
+ const ACCEPT_CALL_ACTION_ID = 'accept';
19
+ const DECLINE_CALL_ACTION_ID = 'decline';
18
20
  let lastFirebaseToken = {
19
21
  token: '',
20
22
  userId: ''
@@ -69,7 +71,8 @@ async function initAndroidPushToken(client, pushConfig, setUnsubscribeListener)
69
71
  await setDeviceToken(token);
70
72
  }
71
73
  }
72
- const messaging = pushConfig.isExpo ? (0, _libs.getFirebaseMessagingLibNoThrow)(true) : (0, _libs.getFirebaseMessagingLib)();
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)();
73
76
  if (messaging) {
74
77
  logger.debug(`setting firebase token listeners`);
75
78
  const unsubscribe = messaging().onTokenRefresh(refreshedToken => setDeviceToken(refreshedToken));
@@ -83,8 +86,8 @@ async function initAndroidPushToken(client, pushConfig, setUnsubscribeListener)
83
86
  * Creates notification from the push message data.
84
87
  * For Ringing and Non-Ringing calls.
85
88
  */
86
-
87
89
  const firebaseDataHandler = async data => {
90
+ if (_reactNative.Platform.OS !== 'android') return;
88
91
  /* Example data from firebase
89
92
  "message": {
90
93
  "data": {
@@ -100,171 +103,174 @@ const firebaseDataHandler = async data => {
100
103
  // other stuff
101
104
  }
102
105
  */
103
- if (_reactNative.Platform.OS !== 'android') return;
104
- const logger = _videoClient.videoLoggerSystem.getLogger('firebaseDataHandler');
105
106
  const pushConfig = _StreamVideoRN.StreamVideoRN.getConfig().push;
106
107
  if (!pushConfig || !data || data.sender !== 'stream.video') {
107
108
  return;
108
109
  }
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
+ }
109
118
  if (data.type === 'call.ring') {
110
119
  const call_cid = data.call_cid;
111
- if (!call_cid) {
112
- logger.debug(`call_cid is not provided, skipping the call.ring notification`);
113
- return;
114
- }
115
- const callingx = (0, _callingx.getCallingxLib)();
116
- if (!callingx.canPostNotifications) {
117
- logger.warn(`Cannot post notifications, skipping the call.ring notification`);
118
- return;
119
- }
120
- const client = await pushConfig.createStreamVideoClient();
121
- if (!client) {
122
- logger.debug(`video client not found, skipping the call.ring notification`);
123
- return;
124
- }
125
- const shouldRejectCallWhenBusy = client['rejectCallWhenBusy'] ?? false;
126
- if (callingx.hasRegisteredCall() && shouldRejectCallWhenBusy) {
127
- logger.debug(`registered call found, skipping the call.ring notification`);
128
- return;
129
- }
130
- const asForegroundService = (0, _utils.canListenToWS)();
131
- const callerName = data.created_by_display_name;
132
- const hasVideo = data.video === 'true';
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();
133
132
  if (asForegroundService) {
134
133
  // Listen to call events from WS through fg service
135
134
  // note: this will replace the current empty fg service runner
136
- //we need to start service (e.g. by calling display incoming call) and than launch bg task, consider making those steps independent
137
- callingx.registerBackgroundTask((_, stopTask) => {
138
- return new Promise(resolve => {
139
- const finishBackgroundTask = () => {
140
- callingx.log(`Finishing background task for callCid: ${call_cid}`, 'debug');
141
- resolve(undefined);
142
- stopTask();
143
- };
144
- (async () => {
145
- try {
146
- const _client = await pushConfig.createStreamVideoClient();
147
- if (!_client) {
148
- logger.debug(`Closing fg service as there is no client to create from push config`);
149
- finishBackgroundTask();
150
- return;
151
- }
152
- const callFromPush = await _client.onRingingCall(call_cid);
153
- const {
154
- mustEndCall,
155
- endCallReason
156
- } = (0, _utils.shouldCallBeClosed)(callFromPush, data);
157
- if (mustEndCall) {
158
- logger.debug(`Closing fg service callCid: ${call_cid} endCallReason: ${endCallReason}`);
159
- finishBackgroundTask();
160
- callingx.log(`Ending call with callCid: ${call_cid} endCallReason: ${endCallReason}`, 'debug');
161
- callingx.endCallWithReason(call_cid, endCallReason);
162
- return;
163
- }
164
- const unsubscribeFunctions = [];
165
- // check if service needs to be closed if accept/decline event was done on another device
166
- const unsubscribe = callFromPush.on('all', event => {
167
- const _canListenToWS = (0, _utils.canListenToWS)();
168
- if (!_canListenToWS) {
169
- logger.debug(`Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS}`, {
170
- event
171
- });
172
- unsubscribeFunctions.forEach(fn => fn());
173
- finishBackgroundTask();
174
- return;
175
- }
176
- const {
177
- mustEndCall: mustEndCallFromEvent,
178
- endCallReason: endCallReasonFromEvent
179
- } = (0, _utils.shouldCallBeClosed)(callFromPush, data);
180
- if (mustEndCallFromEvent) {
181
- logger.debug(`Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS} shouldCallBeClosed`, {
182
- event
183
- });
184
- unsubscribeFunctions.forEach(fn => fn());
185
- finishBackgroundTask();
186
- callingx.endCallWithReason(call_cid, endCallReasonFromEvent);
187
- }
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
188
157
  });
189
-
190
- // check if service needs to be closed if call was left
191
- const stateSubscription = callFromPush.state.callingState$.subscribe(callingState => {
192
- if (callingState === _videoClient.CallingState.IDLE || callingState === _videoClient.CallingState.LEFT) {
193
- logger.debug(`Closing fg service from callingState callCid: ${call_cid} callingState: ${callingState}`);
194
- unsubscribeFunctions.forEach(fn => fn());
195
- callingx.log(`Ending call with callCid: ${call_cid} callingState: ${callingState}`, 'debug');
196
- finishBackgroundTask();
197
- }
198
- });
199
- const endCallSubscription = callingx.addEventListener('endCall', async ({
200
- callId
201
- }) => {
202
- unsubscribeFunctions.forEach(fn => fn());
203
- try {
204
- await callFromPush.leave({
205
- reject: true,
206
- reason: 'decline'
207
- });
208
- } catch (error) {
209
- logger.error(`Failed to leave call with callCid: ${call_cid} error: ${error}`);
210
- } finally {
211
- callingx.log(`Ending call with callCid: ${call_cid} callId: ${callId}`, 'debug');
212
- finishBackgroundTask();
213
- }
214
- });
215
-
216
- //stop background task when app comes to foreground
217
- const appStateSubscription = _reactNative.AppState.addEventListener('change', nextAppState => {
218
- const _canListenToWS = (0, _utils.canListenToWS)();
219
- callingx.log(`AppState changed to: ${nextAppState} for callCid: ${call_cid} canListenToWS: ${_canListenToWS}`, 'debug');
220
- if (!_canListenToWS) {
221
- unsubscribeFunctions.forEach(fn => fn());
222
- finishBackgroundTask();
223
- return;
224
- }
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
225
166
  });
226
- unsubscribeFunctions.push(unsubscribe);
227
- unsubscribeFunctions.push(() => stateSubscription.unsubscribe());
228
- unsubscribeFunctions.push(() => endCallSubscription.remove());
229
- unsubscribeFunctions.push(() => appStateSubscription.remove());
230
- _constants.pushUnsubscriptionCallbacks.get(call_cid)?.forEach(cb => cb());
231
- _constants.pushUnsubscriptionCallbacks.set(call_cid, unsubscribeFunctions);
232
- } catch (error) {
233
- callingx.log(`Failed to start background task with callCid: ${call_cid} error: ${error}`, 'error');
234
- finishBackgroundTask();
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();
235
177
  }
236
- })();
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);
237
183
  });
238
184
  });
239
185
  }
240
- await callingx.displayIncomingCall(call_cid, call_cid, callerName, hasVideo);
241
- logger.debug(`Displaying incoming call notification with callCid: ${call_cid} asForegroundService: ${asForegroundService}`);
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
+ });
242
252
  if (asForegroundService) {
243
253
  // no need to check if call has be closed as that will be handled by the fg service
244
254
  return;
245
255
  }
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
+ }
246
263
  const callFromPush = await client.onRingingCall(call_cid);
247
- const {
248
- mustEndCall,
249
- endCallReason
250
- } = (0, _utils.shouldCallBeClosed)(callFromPush, data);
251
- if (mustEndCall) {
252
- logger.debug(`Removing incoming call notification immediately with callCid: ${call_cid} as it should be closed`);
253
- callingx.endCallWithReason(call_cid, endCallReason);
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);
254
267
  }
255
268
  } else {
256
- const notifeeLib = (0, _libs.getNotifeeLibThrowIfNotInstalledForPush)();
257
- const notifee = notifeeLib.default;
258
- const settings = await notifee.getNotificationSettings();
259
- if (settings.authorizationStatus !== 1) {
260
- logger.debug(`Notification permission not granted, unable to post ${data.type} notifications`);
261
- return;
262
- }
263
-
264
269
  // the other types are call.live_started and call.notification
265
270
  const callChannel = pushConfig.android.callChannel;
266
271
  const callNotificationTextGetters = pushConfig.android.callNotificationTextGetters;
267
272
  if (!callChannel || !callNotificationTextGetters) {
273
+ const logger = _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler');
268
274
  logger.debug("Can't show call notification as either or both callChannel and callNotificationTextGetters is not provided");
269
275
  return;
270
276
  }
@@ -279,10 +285,10 @@ const firebaseDataHandler = async data => {
279
285
  const type = data.type;
280
286
  const title = getTitle(type, createdUserName);
281
287
  const body = getBody(type, createdUserName);
282
- logger.debug(`Displaying NonRingingPushEvent ${type} notification with title: ${title} body: ${body}`);
288
+ _videoClient.videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Displaying NonRingingPushEvent ${type} notification with title: ${title} body: ${body}`);
283
289
  await notifee.displayNotification({
284
- title,
285
- body,
290
+ title: getTitle(type, createdUserName),
291
+ body: getBody(type, createdUserName),
286
292
  data,
287
293
  android: {
288
294
  sound: callChannel.sound,
@@ -307,7 +313,8 @@ const firebaseDataHandler = async data => {
307
313
  };
308
314
  exports.firebaseDataHandler = firebaseDataHandler;
309
315
  const onAndroidNotifeeEvent = async ({
310
- event
316
+ event,
317
+ isBackground
311
318
  }) => {
312
319
  if (_reactNative.Platform.OS !== 'android') return;
313
320
  const {
@@ -315,7 +322,8 @@ const onAndroidNotifeeEvent = async ({
315
322
  detail
316
323
  } = event;
317
324
  const {
318
- notification
325
+ notification,
326
+ pressAction
319
327
  } = detail;
320
328
  const notificationId = notification?.id;
321
329
  const data = notification?.data;
@@ -326,10 +334,53 @@ const onAndroidNotifeeEvent = async ({
326
334
 
327
335
  // we can safely cast to string because the data is from "stream.video"
328
336
  const call_cid = data.call_cid;
329
- const notifeeLib = (0, _libs.getNotifeeLibThrowIfNotInstalledForPush)();
330
- if (type === notifeeLib.EventType.PRESS) {
331
- _videoClient.videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`onTapNonRingingCallNotification with callCId: ${call_cid}`);
332
- pushConfig.onTapNonRingingCallNotification?.(call_cid, data.type);
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
+ }
333
384
  }
334
385
  };
335
386
  exports.onAndroidNotifeeEvent = onAndroidNotifeeEvent;
@@ -1 +1 @@
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","canPostNotifications","createStreamVideoClient","shouldRejectCallWhenBusy","hasRegisteredCall","asForegroundService","canListenToWS","callerName","created_by_display_name","hasVideo","video","registerBackgroundTask","_","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","reason","error","appStateSubscription","AppState","nextAppState","pushUnsubscriptionCallbacks","get","cb","set","displayIncomingCall","notifeeLib","getNotifeeLibThrowIfNotInstalledForPush","notifee","default","settings","getNotificationSettings","authorizationStatus","callChannel","callNotificationTextGetters","createChannel","channelId","getTitle","getBody","createdUserName","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,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI,CAACH,UAAU,CAACI,OAAO,CAACC,gBAAgB,EAAE;IACrE;EACF;EACA,MAAMC,MAAM,GAAGC,8BAAiB,CAACC,SAAS,CAAC,sBAAsB,CAAC;EAClE,MAAMC,cAAc,GAAG,MAAOb,KAAa,IAAK;IAC9C,MAAMC,MAAM,GAAGE,MAAM,CAACW,YAAY,CAACC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GD,MAAM;EAC/B,MAAME,cAAc,GAAGD,YAAY,EAAE1H,EAAE;EACvC,MAAMiB,IAAI,GAAGyG,YAAY,EAAEzG,IAAI;EAC/B,MAAM7B,UAAU,GAAGwC,4BAAa,CAACC,SAAS,CAAC,CAAC,CAACC,IAAI;EACjD,IACE,CAAC1C,UAAU,IACX,CAAC6B,IAAI,IACL,CAAC0G,cAAc,IACf1G,IAAI,CAACc,MAAM,KAAK,cAAc,EAC9B;IACA;EACF;;EAEA;EACA,MAAME,QAAQ,GAAGhB,IAAI,CAACgB,QAAkB;EAExC,MAAM2D,UAAU,GAAG,IAAAC,6CAAuC,EAAC,CAAC;EAC5D,IAAI7D,IAAI,KAAK4D,UAAU,CAACgC,SAAS,CAACC,KAAK,EAAE;IACvClI,8BAAiB,CACdC,SAAS,CAAC,uBAAuB,CAAC,CAClCM,KAAK,CAAC,iDAAiD+B,QAAQ,EAAE,CAAC;IACrE7C,UAAU,CAACuB,+BAA+B,GACxCsB,QAAQ,EACRhB,IAAI,CAACe,IACP,CAAC;EACH;AACF,CAAC;AAACuF,OAAA,CAAAC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
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,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tF,CAAC;QACH;MACF;MACA9C,8BAAiB,CACdC,SAAS,CAAC,uBAAuB,CAAC,CAClCM,KAAK,CACJ,wEAAwEuC,QAAQ,EAClF,CAAC;MACH,MAAM,IAAA4F,sCAA+B,EAACjJ,UAAU,EAAEqD,QAAQ,EAAE,SAAS,CAAC;IACxE,CAAC,MAAM;MACL,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":[]}
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.onVoipNotificationReceived = void 0;
7
7
  var _reactNative = require("react-native");
8
+ var _libs = require("../libs");
9
+ var _rxSubjects = require("./rxSubjects");
8
10
  var _constants = require("./constants");
9
11
  var _utils = require("./utils");
10
12
  var _videoClient = require("@stream-io/video-client");
11
- var _callingx = require("../libs/callingx");
12
13
  const onVoipNotificationReceived = async (notification, pushConfig) => {
13
14
  /* --- Example payload ---
14
15
  {
@@ -32,7 +33,6 @@ const onVoipNotificationReceived = async (notification, pushConfig) => {
32
33
  "version": "v2"
33
34
  }
34
35
  } */
35
- const logger = _videoClient.videoLoggerSystem.getLogger('callingx - onVoipNotificationReceived');
36
36
  const sender = notification?.stream?.sender;
37
37
  const type = notification?.stream?.type;
38
38
  // do not process any other notifications other than stream.video or ringing
@@ -43,34 +43,50 @@ const onVoipNotificationReceived = async (notification, pushConfig) => {
43
43
  if (!call_cid || _reactNative.Platform.OS !== 'ios' || !pushConfig.ios.pushProviderName) {
44
44
  return;
45
45
  }
46
- const callingx = (0, _callingx.getCallingxLib)();
47
- if (callingx.isCallTracked(call_cid)) {
48
- //same call_cid is already tracked, so we skip the notification
49
- logger.debug(`the same call_cid ${call_cid} is already tracked, skipping the call.ring notification`);
50
- return;
51
- }
46
+ const logger = _videoClient.videoLoggerSystem.getLogger('setupIosVoipPushEvents');
52
47
  const client = await pushConfig.createStreamVideoClient();
53
48
  if (!client) {
54
49
  logger.debug('client not found, not processing call.ring voip push notification');
55
50
  return;
56
51
  }
52
+ const shouldRejectCallWhenBusy = client['rejectCallWhenBusy'] ?? false;
53
+ if (shouldRejectCallWhenBusy) {
54
+ // inform the iOS native module that we should reject call when busy
55
+ _reactNative.NativeModules.StreamVideoReactNative.setShouldRejectCallWhenBusy(shouldRejectCallWhenBusy);
56
+ }
57
57
  const callFromPush = await client.onRingingCall(call_cid);
58
+ let uuid = '';
59
+ try {
60
+ uuid = await _reactNative.NativeModules?.StreamVideoReactNative?.getIncomingCallUUid(call_cid);
61
+ } catch (error) {
62
+ logger.error('Error in getting call uuid from native module', error);
63
+ }
64
+ if (!uuid) {
65
+ logger.error(`Not processing call.ring push notification, as no uuid found for call_cid: ${call_cid}`);
66
+ return;
67
+ }
68
+ const created_by_id = notification?.stream?.created_by_id;
69
+ const receiver_id = notification?.stream?.receiver_id;
58
70
  function closeCallIfNecessary() {
59
71
  const {
60
72
  mustEndCall,
61
- endCallReason
62
- } = (0, _utils.shouldCallBeClosed)(callFromPush, notification?.stream);
73
+ callkeepReason
74
+ } = (0, _utils.shouldCallBeEnded)(callFromPush, created_by_id, receiver_id);
63
75
  if (mustEndCall) {
64
- logger.debug(`callingx.endCallWithReason for call_cid: ${call_cid} endCallReason: ${endCallReason}`);
65
- callingx.endCallWithReason(call_cid, endCallReason);
76
+ const callkeep = (0, _libs.getCallKeepLib)();
77
+ logger.debug(`callkeep.reportEndCallWithUUID for uuid: ${uuid}, call_cid: ${call_cid}, reason: ${callkeepReason}`);
78
+ callkeep.reportEndCallWithUUID(uuid, callkeepReason);
79
+ const voipPushNotification = (0, _libs.getVoipPushNotificationLib)();
80
+ voipPushNotification.onVoipNotificationCompleted(uuid);
66
81
  return true;
67
82
  }
68
83
  return false;
69
84
  }
70
85
  const closed = closeCallIfNecessary();
71
- if (!closed && (0, _utils.canListenToWS)()) {
86
+ const canListenToWS = () => _utils.canAddPushWSSubscriptionsRef.current && _reactNative.AppState.currentState !== 'active';
87
+ if (!closed && canListenToWS()) {
72
88
  const unsubscribe = callFromPush.on('all', event => {
73
- const _canListenToWS = (0, _utils.canListenToWS)();
89
+ const _canListenToWS = canListenToWS();
74
90
  if (!_canListenToWS) {
75
91
  logger.debug(`unsubscribe due to event callCid: ${call_cid} canListenToWS: ${_canListenToWS}`, event);
76
92
  unsubscribe();
@@ -85,9 +101,10 @@ const onVoipNotificationReceived = async (notification, pushConfig) => {
85
101
  _constants.pushUnsubscriptionCallbacks.get(call_cid)?.forEach(cb => cb());
86
102
  _constants.pushUnsubscriptionCallbacks.set(call_cid, [unsubscribe]);
87
103
  }
88
-
89
- // callingx event listeners (setupCallingExpEvents) will handle accept/reject
90
- logger.debug(`call_cid:${call_cid} received and processed from call.ring push notification`);
104
+ // send the info to this subject, it is listened by callkeep events
105
+ // callkeep events will then accept/reject the call
106
+ logger.debug(`call_cid:${call_cid} uuid:${uuid} received and processed from call.ring push notification`);
107
+ _rxSubjects.voipPushNotificationCallCId$.next(call_cid);
91
108
  };
92
109
  exports.onVoipNotificationReceived = onVoipNotificationReceived;
93
110
  //# sourceMappingURL=ios.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_constants","_utils","_videoClient","_callingx","onVoipNotificationReceived","notification","pushConfig","logger","videoLoggerSystem","getLogger","sender","stream","type","call_cid","Platform","OS","ios","pushProviderName","callingx","getCallingxLib","isCallTracked","debug","client","createStreamVideoClient","callFromPush","onRingingCall","closeCallIfNecessary","mustEndCall","endCallReason","shouldCallBeClosed","endCallWithReason","closed","canListenToWS","unsubscribe","on","event","_canListenToWS","_closed","pushUnsubscriptionCallbacks","get","forEach","cb","set","exports"],"sourceRoot":"../../../../../src","sources":["utils/push/internal/ios.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAEO,MAAMK,0BAA0B,GAAG,MAAAA,CACxCC,YAAiB,EACjBC,UAAkD,KAC/C;EACH;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,MAAM,GAAGC,8BAAiB,CAACC,SAAS,CACxC,uCACF,CAAC;EAED,MAAMC,MAAM,GAAGL,YAAY,EAAEM,MAAM,EAAED,MAAM;EAC3C,MAAME,IAAI,GAAGP,YAAY,EAAEM,MAAM,EAAEC,IAAI;EACvC;EACA,IAAIF,MAAM,KAAK,cAAc,IAAIE,IAAI,KAAK,WAAW,EAAE;IACrD;EACF;EAEA,MAAMC,QAAQ,GAAGR,YAAY,E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BAAmBuB,cAAc,EAAE,EAChFD,KACF,CAAC;QACDF,WAAW,CAAC,CAAC;QACb;MACF;MACA,MAAMI,OAAO,GAAGX,oBAAoB,CAAC,CAAC;MACtC,IAAIW,OAAO,EAAE;QACX9B,MAAM,CAACc,KAAK,CACV,qCAAqCR,QAAQ,mBAAmBuB,cAAc,wBAAwBC,OAAO,EAAE,EAC/GF,KACF,CAAC;QACDF,WAAW,CAAC,CAAC;MACf;IACF,CAAC,CAAC;IAEFK,sCAA2B,CAACC,GAAG,CAAC1B,QAAQ,CAAC,EAAE2B,OAAO,CAAEC,EAAE,IAAKA,EAAE,CAAC,CAAC,CAAC;IAChEH,sCAA2B,CAACI,GAAG,CAAC7B,QAAQ,EAAE,CAACoB,WAAW,CAAC,CAAC;EAC1D;;EAEA;EACA1B,MAAM,CAACc,KAAK,CACV,YAAYR,QAAQ,0DACtB,CAAC;AACH,CAAC;AAAC8B,OAAA,CAAAvC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_libs","_rxSubjects","_constants","_utils","_videoClient","onVoipNotificationReceived","notification","pushConfig","sender","stream","type","call_cid","Platform","OS","ios","pushProviderName","logger","videoLoggerSystem","getLogger","client","createStreamVideoClient","debug","shouldRejectCallWhenBusy","NativeModules","StreamVideoReactNative","setShouldRejectCallWhenBusy","callFromPush","onRingingCall","uuid","getIncomingCallUUid","error","created_by_id","receiver_id","closeCallIfNecessary","mustEndCall","callkeepReason","shouldCallBeEnded","callkeep","getCallKeepLib","reportEndCallWithUUID","voipPushNotification","getVoipPushNotificationLib","onVoipNotificationCompleted","closed","canListenToWS","canAddPushWSSubscriptionsRef","current","AppState","currentState","unsubscribe","on","event","_canListenToWS","_closed","pushUnsubscriptionCallbacks","get","forEach","cb","set","voipPushNotificationCallCId$","next","exports"],"sourceRoot":"../../../../../src","sources":["utils/push/internal/ios.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAA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