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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/CHANGELOG.md +11 -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/Participant/ParticipantView/ParticipantLabel.js +2 -6
  9. package/dist/commonjs/components/Participant/ParticipantView/ParticipantLabel.js.map +1 -1
  10. package/dist/commonjs/hooks/push/index.js +2 -0
  11. package/dist/commonjs/hooks/push/index.js.map +1 -1
  12. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +160 -0
  13. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
  14. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
  15. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  16. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +67 -0
  17. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +1 -0
  18. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +97 -64
  19. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  20. package/dist/commonjs/index.js +0 -1
  21. package/dist/commonjs/index.js.map +1 -1
  22. package/dist/commonjs/modules/call-manager/CallManager.js +0 -26
  23. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  24. package/dist/commonjs/providers/StreamCall/index.js +6 -6
  25. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  26. package/dist/commonjs/utils/StreamVideoRN/index.js +21 -35
  27. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  28. package/dist/commonjs/utils/internal/registerSDKGlobals.js +3 -53
  29. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  30. package/dist/commonjs/utils/push/android.js +202 -135
  31. package/dist/commonjs/utils/push/android.js.map +1 -1
  32. package/dist/commonjs/utils/push/internal/ios.js +34 -17
  33. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  34. package/dist/commonjs/utils/push/internal/rxSubjects.js +45 -1
  35. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  36. package/dist/commonjs/utils/push/internal/utils.js +53 -71
  37. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  38. package/dist/commonjs/utils/push/ios.js.map +1 -1
  39. package/dist/commonjs/utils/push/libs/callkeep.js +17 -0
  40. package/dist/commonjs/utils/push/libs/callkeep.js.map +1 -0
  41. package/dist/commonjs/utils/push/libs/index.js +19 -8
  42. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  43. package/dist/commonjs/utils/push/libs/notifee/index.js +19 -0
  44. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  45. package/dist/commonjs/utils/push/libs/voipPushNotification.js +17 -0
  46. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +1 -0
  47. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +205 -0
  48. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +1 -0
  49. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +6 -7
  50. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  51. package/dist/commonjs/version.js +1 -1
  52. package/dist/commonjs/version.js.map +1 -1
  53. package/dist/module/components/Participant/ParticipantView/ParticipantLabel.js +2 -6
  54. package/dist/module/components/Participant/ParticipantView/ParticipantLabel.js.map +1 -1
  55. package/dist/module/hooks/push/index.js +2 -0
  56. package/dist/module/hooks/push/index.js.map +1 -1
  57. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +153 -0
  58. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
  59. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
  60. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  61. package/dist/module/hooks/push/useProcessPushCallEffect.js +60 -0
  62. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +1 -0
  63. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +99 -66
  64. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  65. package/dist/module/index.js +0 -1
  66. package/dist/module/index.js.map +1 -1
  67. package/dist/module/modules/call-manager/CallManager.js +0 -26
  68. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  69. package/dist/module/providers/StreamCall/index.js +6 -6
  70. package/dist/module/providers/StreamCall/index.js.map +1 -1
  71. package/dist/module/utils/StreamVideoRN/index.js +21 -35
  72. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  73. package/dist/module/utils/internal/registerSDKGlobals.js +3 -53
  74. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  75. package/dist/module/utils/push/android.js +204 -137
  76. package/dist/module/utils/push/android.js.map +1 -1
  77. package/dist/module/utils/push/internal/ios.js +34 -17
  78. package/dist/module/utils/push/internal/ios.js.map +1 -1
  79. package/dist/module/utils/push/internal/rxSubjects.js +44 -0
  80. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  81. package/dist/module/utils/push/internal/utils.js +50 -67
  82. package/dist/module/utils/push/internal/utils.js.map +1 -1
  83. package/dist/module/utils/push/ios.js.map +1 -1
  84. package/dist/module/utils/push/libs/callkeep.js +11 -0
  85. package/dist/module/utils/push/libs/callkeep.js.map +1 -0
  86. package/dist/module/utils/push/libs/index.js +2 -1
  87. package/dist/module/utils/push/libs/index.js.map +1 -1
  88. package/dist/module/utils/push/libs/notifee/index.js +18 -0
  89. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  90. package/dist/module/utils/push/libs/voipPushNotification.js +11 -0
  91. package/dist/module/utils/push/libs/voipPushNotification.js.map +1 -0
  92. package/dist/module/utils/push/setupIosCallKeepEvents.js +199 -0
  93. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +1 -0
  94. package/dist/module/utils/push/setupIosVoipPushEvents.js +6 -7
  95. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  96. package/dist/module/version.js +1 -1
  97. package/dist/module/version.js.map +1 -1
  98. package/dist/typescript/components/Participant/ParticipantView/ParticipantLabel.d.ts.map +1 -1
  99. package/dist/typescript/hooks/push/index.d.ts.map +1 -1
  100. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +5 -0
  101. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +1 -0
  102. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  103. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +8 -0
  104. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +1 -0
  105. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  106. package/dist/typescript/index.d.ts +0 -1
  107. package/dist/typescript/index.d.ts.map +1 -1
  108. package/dist/typescript/modules/call-manager/CallManager.d.ts +0 -5
  109. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  110. package/dist/typescript/utils/StreamVideoRN/index.d.ts +2 -22
  111. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  112. package/dist/typescript/utils/StreamVideoRN/types.d.ts +25 -59
  113. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  114. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  115. package/dist/typescript/utils/push/android.d.ts +2 -1
  116. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  117. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  118. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +33 -0
  119. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  120. package/dist/typescript/utils/push/internal/utils.d.ts +8 -14
  121. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  122. package/dist/typescript/utils/push/ios.d.ts +2 -1
  123. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  124. package/dist/typescript/utils/push/libs/callkeep.d.ts +3 -0
  125. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +1 -0
  126. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts +2 -16
  127. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
  128. package/dist/typescript/utils/push/libs/index.d.ts +2 -1
  129. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  130. package/dist/typescript/utils/push/libs/notifee/index.d.ts +1 -0
  131. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  132. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +3 -0
  133. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +1 -0
  134. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +6 -0
  135. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +1 -0
  136. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  137. package/dist/typescript/version.d.ts +1 -1
  138. package/dist/typescript/version.d.ts.map +1 -1
  139. package/expo-config-plugin/dist/withAndroidManifest.js +33 -1
  140. package/expo-config-plugin/dist/withAndroidPermissions.js +7 -2
  141. package/expo-config-plugin/dist/withAppDelegate.js +197 -19
  142. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  143. package/expo-config-plugin/dist/withiOSInfoPlist.js +3 -2
  144. package/ios/StreamInCallManager.m +0 -2
  145. package/ios/StreamInCallManager.swift +7 -19
  146. package/ios/StreamVideoReactNative.h +4 -7
  147. package/ios/StreamVideoReactNative.m +82 -189
  148. package/package.json +16 -11
  149. package/src/components/Participant/ParticipantView/ParticipantLabel.tsx +2 -7
  150. package/src/hooks/push/index.ts +2 -0
  151. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +235 -0
  152. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +34 -21
  153. package/src/hooks/push/useProcessPushCallEffect.ts +108 -0
  154. package/src/hooks/useAndroidKeepCallAliveEffect.ts +120 -94
  155. package/src/index.ts +0 -1
  156. package/src/modules/call-manager/CallManager.ts +0 -36
  157. package/src/modules/call-manager/native-module.d.ts +0 -7
  158. package/src/providers/StreamCall/index.tsx +6 -6
  159. package/src/utils/StreamVideoRN/index.ts +30 -42
  160. package/src/utils/StreamVideoRN/types.ts +25 -61
  161. package/src/utils/internal/registerSDKGlobals.ts +4 -52
  162. package/src/utils/push/android.ts +311 -198
  163. package/src/utils/push/internal/ios.ts +44 -28
  164. package/src/utils/push/internal/rxSubjects.ts +61 -0
  165. package/src/utils/push/internal/utils.ts +64 -108
  166. package/src/utils/push/ios.ts +6 -1
  167. package/src/utils/push/libs/callkeep.ts +16 -0
  168. package/src/utils/push/libs/index.ts +2 -1
  169. package/src/utils/push/libs/notifee/index.ts +27 -0
  170. package/src/utils/push/libs/voipPushNotification.ts +17 -0
  171. package/src/utils/push/setupIosCallKeepEvents.ts +252 -0
  172. package/src/utils/push/setupIosVoipPushEvents.ts +7 -11
  173. package/src/version.ts +1 -1
  174. package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +0 -83
  175. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +0 -149
  176. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +0 -144
  177. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
  178. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +0 -68
  179. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +0 -1
  180. package/dist/commonjs/utils/internal/callingx/callingx.js +0 -150
  181. package/dist/commonjs/utils/internal/callingx/callingx.js.map +0 -1
  182. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +0 -48
  183. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +0 -1
  184. package/dist/commonjs/utils/push/libs/callingx.js +0 -75
  185. package/dist/commonjs/utils/push/libs/callingx.js.map +0 -1
  186. package/dist/commonjs/utils/push/setupCallingExpEvents.js +0 -105
  187. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +0 -1
  188. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +0 -137
  189. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
  190. package/dist/module/utils/internal/callingx/audioSessionPromise.js +0 -61
  191. package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +0 -1
  192. package/dist/module/utils/internal/callingx/callingx.js +0 -140
  193. package/dist/module/utils/internal/callingx/callingx.js.map +0 -1
  194. package/dist/module/utils/keepCallAliveHeadlessTask.js +0 -42
  195. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +0 -1
  196. package/dist/module/utils/push/libs/callingx.js +0 -67
  197. package/dist/module/utils/push/libs/callingx.js.map +0 -1
  198. package/dist/module/utils/push/setupCallingExpEvents.js +0 -99
  199. package/dist/module/utils/push/setupCallingExpEvents.js.map +0 -1
  200. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +0 -5
  201. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +0 -1
  202. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +0 -16
  203. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +0 -1
  204. package/dist/typescript/utils/internal/callingx/callingx.d.ts +0 -18
  205. package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +0 -1
  206. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +0 -10
  207. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +0 -1
  208. package/dist/typescript/utils/push/libs/callingx.d.ts +0 -9
  209. package/dist/typescript/utils/push/libs/callingx.d.ts.map +0 -1
  210. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +0 -8
  211. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +0 -1
  212. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +0 -189
  213. package/src/utils/internal/callingx/audioSessionPromise.ts +0 -65
  214. package/src/utils/internal/callingx/callingx.ts +0 -194
  215. package/src/utils/keepCallAliveHeadlessTask.ts +0 -54
  216. package/src/utils/push/libs/callingx.ts +0 -89
  217. package/src/utils/push/setupCallingExpEvents.ts +0 -135
@@ -10,16 +10,17 @@ type CanAddPushWSSubscriptionsRef = {
10
10
  */
11
11
  export declare const shouldCallBeEnded: (callFromPush: Call, created_by_id: string | undefined, receiver_id: string | undefined) => {
12
12
  mustEndCall: boolean;
13
- endCallReason: "remote" | "rejected" | "answeredElsewhere" | "canceled" | "unknown";
13
+ callkeepReason: number;
14
14
  };
15
- export declare const processCallFromPushInBackground: (pushConfig: PushConfig, call_cid: string, action: "accept" | "decline" | "pressed" | "backgroundDelivered",
15
+ export declare const processCallFromPushInBackground: (pushConfig: PushConfig, call_cid: string, action: Parameters<typeof processCallFromPush>[2]) => Promise<void>;
16
16
  /**
17
- * Callback to inform iOS CallKit that the action can be fulfilled
18
- * Needed for iOS CallKit fullfillment of action
19
- * as per ios docs "Instead, wait until you establish a connection and then fulfill the object."
20
- * This means we wait until call.get() is done and call.join() or call.leave() is invoked (not completed) to fulfill the action
17
+ * This function is used process the call from push notifications due to incoming call
18
+ * It does the following steps:
19
+ * 1. Get the call from the client if present or create a new call
20
+ * 2. Fetch the latest state of the call from the server if its not already in ringing state
21
+ * 3. Join or leave the call based on the user's action.
21
22
  */
22
- onIOSActionCanBeFulfilled: (didFail: boolean) => void) => Promise<void>;
23
+ export declare const processCallFromPush: (client: StreamVideoClient, call_cid: string, action: "accept" | "decline" | "pressed" | "backgroundDelivered", pushConfig: PushConfig) => Promise<void>;
23
24
  /**
24
25
  * This function is used process the call from push notifications due to non ringing calls
25
26
  * It does the following steps:
@@ -38,12 +39,5 @@ export declare const clearPushWSEventSubscriptions: (call_cid: string) => void;
38
39
  * It is used to avoid adding the push WS subscriptions when the client is connected to WS in the foreground
39
40
  */
40
41
  export declare const canAddPushWSSubscriptionsRef: CanAddPushWSSubscriptionsRef;
41
- export declare const canListenToWS: () => boolean;
42
- export declare const shouldCallBeClosed: (call: Call, pushData: {
43
- [key: string]: string | object;
44
- }) => {
45
- mustEndCall: boolean;
46
- endCallReason: "remote" | "rejected" | "answeredElsewhere" | "canceled" | "unknown";
47
- };
48
42
  export {};
49
43
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/internal/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAEJ,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAMnC,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAGzD,KAAK,4BAA4B,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,cAAc,IAAI,EAClB,eAAe,MAAM,GAAG,SAAS,EACjC,aAAa,MAAM,GAAG,SAAS;;;CAoChC,CAAC;AAMF,eAAO,MAAM,+BAA+B,GAC1C,YAAY,UAAU,EACtB,UAAU,MAAM,EAChB,QAAQ,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,qBAAqB;AAChE;;;;;GAKG;AACH,2BAA2B,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,kBAmFtD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,GACzC,QAAQ,iBAAiB,EACzB,UAAU,MAAM,EAChB,4BAA4B,mBAAmB,kBAwBhD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GAAI,UAAU,MAAM,SAM7D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,4BAE1C,CAAC;AAEF,eAAO,MAAM,aAAa,eACkD,CAAC;AAE7E,eAAO,MAAM,kBAAkB,GAC7B,MAAM,IAAI,EACV,UAAU;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE;;;CAW7C,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/internal/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAEJ,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAInC,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAEzD,KAAK,4BAA4B,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,cAAc,IAAI,EAClB,eAAe,MAAM,GAAG,SAAS,EACjC,aAAa,MAAM,GAAG,SAAS;;;CAwChC,CAAC;AAMF,eAAO,MAAM,+BAA+B,GAC1C,YAAY,UAAU,EACtB,UAAU,MAAM,EAChB,QAAQ,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,kBAiBlD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,iBAAiB,EACzB,UAAU,MAAM,EAChB,QAAQ,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,qBAAqB,EAChE,YAAY,UAAU,kBAoCvB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,GACzC,QAAQ,iBAAiB,EACzB,UAAU,MAAM,EAChB,4BAA4B,mBAAmB,kBAqBhD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GAAI,UAAU,MAAM,SAM7D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,4BAE1C,CAAC"}
@@ -4,8 +4,9 @@ import { StreamVideoClient } from '@stream-io/video-client';
4
4
  import type { Event } from '@notifee/react-native';
5
5
  type PushConfig = NonNullable<StreamVideoConfig['push']>;
6
6
  export declare const oniOSExpoNotificationEvent: (event: ExpoNotification) => void;
7
- export declare const oniOSNotifeeEvent: ({ event }: {
7
+ export declare const oniOSNotifeeEvent: ({ event, }: {
8
8
  event: Event;
9
+ isBackground: boolean;
9
10
  }) => void;
10
11
  export declare function onPushNotificationiOSStreamVideoEvent(notification: PushNotificationiOSType): void;
11
12
  /** Send token to stream */
@@ -1 +1 @@
1
- {"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/ios.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EACL,KAAK,gBAAgB,EAIrB,KAAK,uBAAuB,EAC7B,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,iBAAiB,EAAqB,MAAM,yBAAyB,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAuBzD,eAAO,MAAM,0BAA0B,GAAI,OAAO,gBAAgB,SAuBjE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,WAAW;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,SAkB5D,CAAC;AAEF,wBAAgB,qCAAqC,CACnD,YAAY,EAAE,uBAAuB,QAkCtC;AAED,2BAA2B;AAC3B,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,IAAI,KAAK,IAAI,iBAiF1D"}
1
+ {"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/ios.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EACL,KAAK,gBAAgB,EAIrB,KAAK,uBAAuB,EAC7B,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,iBAAiB,EAAqB,MAAM,yBAAyB,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAuBzD,eAAO,MAAM,0BAA0B,GAAI,OAAO,gBAAgB,SAuBjE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,YAE/B;IACD,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,SAkBA,CAAC;AAEF,wBAAgB,qCAAqC,CACnD,YAAY,EAAE,uBAAuB,QAkCtC;AAED,2BAA2B;AAC3B,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,IAAI,KAAK,IAAI,iBAiF1D"}
@@ -0,0 +1,3 @@
1
+ export type RNCallKeepType = typeof import('react-native-callkeep').default;
2
+ export declare function getCallKeepLib(): typeof import("react-native-callkeep").default;
3
+ //# sourceMappingURL=callkeep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callkeep.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/libs/callkeep.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,cAAc,uBAAuB,EAAE,OAAO,CAAC;AAQ5E,wBAAgB,cAAc,mDAO7B"}
@@ -1,20 +1,6 @@
1
1
  import { type Type } from './lib';
2
2
  export type { FirebaseMessagingTypes } from '@react-native-firebase/messaging';
3
3
  export type FirebaseMessagingType = Type;
4
- export declare function getFirebaseMessagingLib(): {
5
- (app?: import("@react-native-firebase/app").ReactNativeFirebase.FirebaseApp): import("@react-native-firebase/messaging").Messaging;
6
- readonly SDK_VERSION: string;
7
- } & import("@react-native-firebase/messaging/dist/typescript/lib/types/messaging").Statics & {
8
- messaging: import("@react-native-firebase/app").ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<import("@react-native-firebase/messaging").Messaging, import("@react-native-firebase/messaging/dist/typescript/lib/types/messaging").Statics>;
9
- firebase: import("@react-native-firebase/app").ReactNativeFirebase.Module;
10
- app(name?: string): import("@react-native-firebase/app").ReactNativeFirebase.FirebaseApp;
11
- };
12
- export declare function getFirebaseMessagingLibNoThrow(isExpo: boolean): ({
13
- (app?: import("@react-native-firebase/app").ReactNativeFirebase.FirebaseApp): import("@react-native-firebase/messaging").Messaging;
14
- readonly SDK_VERSION: string;
15
- } & import("@react-native-firebase/messaging/dist/typescript/lib/types/messaging").Statics & {
16
- messaging: import("@react-native-firebase/app").ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<import("@react-native-firebase/messaging").Messaging, import("@react-native-firebase/messaging/dist/typescript/lib/types/messaging").Statics>;
17
- firebase: import("@react-native-firebase/app").ReactNativeFirebase.Module;
18
- app(name?: string): import("@react-native-firebase/app").ReactNativeFirebase.FirebaseApp;
19
- }) | undefined;
4
+ export declare function getFirebaseMessagingLib(): import("@react-native-firebase/app").ReactNativeFirebase.FirebaseModuleWithStatics<import("@react-native-firebase/messaging").FirebaseMessagingTypes.Module, import("@react-native-firebase/messaging").FirebaseMessagingTypes.Statics>;
5
+ export declare function getFirebaseMessagingLibNoThrow(isExpo: boolean): import("@react-native-firebase/app").ReactNativeFirebase.FirebaseModuleWithStatics<import("@react-native-firebase/messaging").FirebaseMessagingTypes.Module, import("@react-native-firebase/messaging").FirebaseMessagingTypes.Statics> | undefined;
20
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/utils/push/libs/firebaseMessaging/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAGvC,YAAY,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAKzC,wBAAgB,uBAAuB;;;;;;;EAQtC;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,OAAO;;;;;;;eAc7D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/utils/push/libs/firebaseMessaging/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAGvC,YAAY,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAKzC,wBAAgB,uBAAuB,4OAQtC;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,OAAO,uPAc7D"}
@@ -1,6 +1,7 @@
1
1
  export * from './expoNotifications';
2
2
  export * from './firebaseMessaging';
3
3
  export * from './iosPushNotification';
4
+ export * from './voipPushNotification';
5
+ export * from './callkeep';
4
6
  export * from './notifee';
5
- export * from './callingx';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
@@ -19,6 +19,7 @@ declare enum AndroidForegroundServiceType {
19
19
  }
20
20
  export declare function getNotifeeLibThrowIfNotInstalledForPush(): typeof import("@notifee/react-native");
21
21
  export declare function getNotifeeLibNoThrowForKeepCallAlive(): typeof import("@notifee/react-native") | undefined;
22
+ export declare function getKeepCallAliveForegroundServiceTypes(): Promise<AndroidForegroundServiceType[]>;
22
23
  export declare function getIncomingCallForegroundServiceTypes(): AndroidForegroundServiceType[];
23
24
  export {};
24
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/utils/push/libs/notifee/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC;AAE9B,aAAK,4BAA4B;IAC/B,8BAA8B,KAAK;IACnC,wCAAwC,KAAK;IAC7C,iCAAiC,IAAI;IACrC,8BAA8B,MAAM;IACpC,gCAAgC,IAAI;IACpC,sCAAsC,IAAI;IAC1C,wCAAwC,KAAK;IAC7C,wCAAwC,OAAO;IAC/C,kCAAkC,MAAM;IACxC,kCAAkC,IAAI;IACtC,wCAAwC,MAAM;IAC9C,qCAAqC,OAAO;IAC5C,mCAAmC,aAAa;IAChD,uCAAuC,OAAO;IAC9C,gCAAgC,KAAK;CACtC;AAKD,wBAAgB,uCAAuC,2CAQtD;AAED,wBAAgB,oCAAoC,uDAEnD;AAED,wBAAgB,qCAAqC,mCAKpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/utils/push/libs/notifee/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC;AAE9B,aAAK,4BAA4B;IAC/B,8BAA8B,KAAK;IACnC,wCAAwC,KAAK;IAC7C,iCAAiC,IAAI;IACrC,8BAA8B,MAAM;IACpC,gCAAgC,IAAI;IACpC,sCAAsC,IAAI;IAC1C,wCAAwC,KAAK;IAC7C,wCAAwC,OAAO;IAC/C,kCAAkC,MAAM;IACxC,kCAAkC,IAAI;IACtC,wCAAwC,MAAM;IAC9C,qCAAqC,OAAO;IAC5C,mCAAmC,aAAa;IAChD,uCAAuC,OAAO;IAC9C,gCAAgC,KAAK;CACtC;AAKD,wBAAgB,uCAAuC,2CAQtD;AAED,wBAAgB,oCAAoC,uDAQnD;AAED,wBAAsB,sCAAsC,4CAiB3D;AAED,wBAAgB,qCAAqC,mCAKpD"}
@@ -0,0 +1,3 @@
1
+ export type VoipPushNotificationType = typeof import('react-native-voip-push-notification').default;
2
+ export declare function getVoipPushNotificationLib(): typeof import("react-native-voip-push-notification").default;
3
+ //# sourceMappingURL=voipPushNotification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voipPushNotification.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/libs/voipPushNotification.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAClC,cAAc,qCAAqC,EAAE,OAAO,CAAC;AAQ/D,wBAAgB,0BAA0B,iEAOzC"}
@@ -0,0 +1,6 @@
1
+ import type { StreamVideoConfig } from '../StreamVideoRN/types';
2
+ /**
3
+ * This hook is used to listen to callkeep events and do the necessary actions
4
+ */
5
+ export declare function setupIosCallKeepEvents(pushConfig: NonNullable<StreamVideoConfig['push']>): void;
6
+ //# sourceMappingURL=setupIosCallKeepEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupIosCallKeepEvents.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/setupIosCallKeepEvents.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAWhE;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,QA4KnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"setupIosVoipPushEvents.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/setupIosVoipPushEvents.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAI3D,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,QA4BnD"}
1
+ {"version":3,"file":"setupIosVoipPushEvents.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/setupIosVoipPushEvents.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,QAyBnD"}
@@ -1,2 +1,2 @@
1
- export declare const version = "1.31.1-beta.0";
1
+ export declare const version = "1.31.1";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,kBAAkB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
@@ -1,10 +1,42 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const config_plugins_1 = require("@expo/config-plugins");
4
- const { getMainActivityOrThrow } = config_plugins_1.AndroidConfig.Manifest;
4
+ const { prefixAndroidKeys, getMainApplicationOrThrow, getMainActivityOrThrow, ensureToolsAvailable, } = config_plugins_1.AndroidConfig.Manifest;
5
+ function getNotifeeService(isKeepCallAliveEnabled = false) {
6
+ /* We add this service to the AndroidManifest.xml:
7
+ <service
8
+ android:name="app.notifee.core.ForegroundService"
9
+ android:stopWithTask="true"
10
+ android:foregroundServiceType="shortService" />
11
+ */
12
+ let foregroundServiceType = 'shortService';
13
+ if (isKeepCallAliveEnabled) {
14
+ foregroundServiceType =
15
+ 'mediaPlayback|camera|microphone|' + foregroundServiceType;
16
+ }
17
+ let head = prefixAndroidKeys({
18
+ name: 'app.notifee.core.ForegroundService',
19
+ stopWithTask: 'true',
20
+ foregroundServiceType,
21
+ });
22
+ head = { ...head, 'tools:replace': 'android:foregroundServiceType' };
23
+ return {
24
+ $: head,
25
+ };
26
+ }
5
27
  const withStreamVideoReactNativeSDKManifest = (configuration, props) => {
6
28
  return (0, config_plugins_1.withAndroidManifest)(configuration, (config) => {
7
29
  const androidManifest = config.modResults;
30
+ const mainApplication = getMainApplicationOrThrow(androidManifest);
31
+ if (props?.ringingPushNotifications || props?.androidKeepCallAlive) {
32
+ ensureToolsAvailable(androidManifest);
33
+ /* Add the notifee foreground Service */
34
+ let services = mainApplication.service ?? [];
35
+ // we filter out the existing notifee service (if any) so that we can override it
36
+ services = services.filter((service) => service.$['android:name'] !== 'app.notifee.core.ForegroundService');
37
+ services.push(getNotifeeService(!!props?.androidKeepCallAlive));
38
+ mainApplication.service = services;
39
+ }
8
40
  if (props?.androidPictureInPicture) {
9
41
  const mainActivity = getMainActivityOrThrow(androidManifest);
10
42
  const currentConfigChangesArray = mainActivity.$['android:configChanges']
@@ -8,15 +8,20 @@ const withStreamVideoReactNativeSDKAndroidPermissions = (configuration, props) =
8
8
  'android.permission.BLUETOOTH_ADMIN',
9
9
  'android.permission.WAKE_LOCK',
10
10
  ];
11
- if (props?.androidKeepCallAlive || props?.enableScreenshare) {
11
+ if (props?.androidKeepCallAlive ||
12
+ props?.ringingPushNotifications ||
13
+ props?.enableScreenshare) {
12
14
  permissions.push('android.permission.POST_NOTIFICATIONS', 'android.permission.FOREGROUND_SERVICE');
13
15
  if (props?.enableScreenshare) {
14
16
  permissions.push('android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION');
15
17
  }
16
18
  }
17
- if (props?.androidKeepCallAlive) {
19
+ if (props?.androidKeepCallAlive || props?.ringingPushNotifications) {
18
20
  permissions.push('android.permission.FOREGROUND_SERVICE_CAMERA', 'android.permission.FOREGROUND_SERVICE_MICROPHONE', 'android.permission.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK');
19
21
  }
22
+ if (props?.ringingPushNotifications?.showWhenLockedAndroid) {
23
+ permissions.push('android.permission.USE_FULL_SCREEN_INTENT');
24
+ }
20
25
  const config = config_plugins_1.AndroidConfig.Permissions.withPermissions(configuration, permissions);
21
26
  return config;
22
27
  };
@@ -9,7 +9,7 @@ const addNewLinesToAppDelegateObjc_1 = __importDefault(require("./common/addNewL
9
9
  const addToSwiftBridgingHeaderFile_1 = require("./common/addToSwiftBridgingHeaderFile");
10
10
  const withAppDelegate = (configuration, props) => {
11
11
  return (0, config_plugins_1.withAppDelegate)(configuration, (config) => {
12
- if (!props?.ringing &&
12
+ if (!props?.ringingPushNotifications &&
13
13
  !props?.iOSEnableMultitaskingCameraAccess &&
14
14
  !props?.addNoiseCancellation) {
15
15
  // quit early if no change is necessary
@@ -21,12 +21,19 @@ const withAppDelegate = (configuration, props) => {
21
21
  config.modResults.contents = (0, codeMod_1.addObjcImports)(config.modResults.contents, ['"NoiseCancellationManagerObjc.h"']);
22
22
  }
23
23
  config.modResults.contents = addDidFinishLaunchingWithOptionsObjc(config.modResults.contents, props.iOSEnableMultitaskingCameraAccess, props.addNoiseCancellation);
24
- if (props?.ringing) {
25
- config.modResults.contents = (0, codeMod_1.addObjcImports)(config.modResults.contents, ['<PushKit/PushKit.h>', '"StreamVideoReactNative.h"']);
24
+ if (props?.ringingPushNotifications) {
25
+ config.modResults.contents = (0, codeMod_1.addObjcImports)(config.modResults.contents, [
26
+ '"RNCallKeep.h"',
27
+ '<PushKit/PushKit.h>',
28
+ '"RNVoipPushNotificationManager.h"',
29
+ '"StreamVideoReactNative.h"',
30
+ '<WebRTC/RTCAudioSession.h>',
31
+ ]);
26
32
  config.modResults.contents =
27
- addDidFinishLaunchingWithOptionsRingingObjc(config.modResults.contents);
33
+ addDidFinishLaunchingWithOptionsRingingObjc(config.modResults.contents, props.ringingPushNotifications);
28
34
  config.modResults.contents = addDidUpdatePushCredentialsObjc(config.modResults.contents);
29
35
  config.modResults.contents = addDidReceiveIncomingPushCallbackObjc(config.modResults.contents);
36
+ config.modResults.contents = addAudioSessionMethodsObjc(config.modResults.contents);
30
37
  }
31
38
  return config;
32
39
  }
@@ -36,7 +43,7 @@ const withAppDelegate = (configuration, props) => {
36
43
  }
37
44
  else {
38
45
  try {
39
- if (props?.ringing) {
46
+ if (props?.ringingPushNotifications) {
40
47
  // make it public class AppDelegate: ExpoAppDelegate, PKPushRegistryDelegate {
41
48
  const regex = /(class\s+AppDelegate[^{]*)(\s*\{)/;
42
49
  config.modResults.contents = config.modResults.contents.replace(regex, (match, declarationPart, openBrace) => {
@@ -69,12 +76,13 @@ const withAppDelegate = (configuration, props) => {
69
76
  config.modResults.contents = (0, codeMod_1.addSwiftImports)(config.modResults.contents, ['stream_io_noise_cancellation_react_native']);
70
77
  }
71
78
  config.modResults.contents = addDidFinishLaunchingWithOptionsSwift(config.modResults.contents, props.iOSEnableMultitaskingCameraAccess, props.addNoiseCancellation);
72
- if (props?.ringing) {
73
- config.modResults.contents = (0, codeMod_1.addSwiftImports)(config.modResults.contents, ['PushKit', 'stream_video_react_native']);
79
+ if (props?.ringingPushNotifications) {
80
+ config.modResults.contents = (0, codeMod_1.addSwiftImports)(config.modResults.contents, ['RNCallKeep', 'PushKit', 'RNVoipPushNotification']);
74
81
  config.modResults.contents =
75
- addDidFinishLaunchingWithOptionsRingingSwift(config.modResults.contents);
82
+ addDidFinishLaunchingWithOptionsRingingSwift(config.modResults.contents, props.ringingPushNotifications);
76
83
  config.modResults.contents = addDidUpdatePushCredentialsSwift(config.modResults.contents);
77
84
  config.modResults.contents = addDidReceiveIncomingPushCallbackSwift(config.modResults.contents);
85
+ config.modResults.contents = addAudioSessionMethodsSwift(config.modResults.contents);
78
86
  }
79
87
  return config;
80
88
  }
@@ -119,26 +127,55 @@ function addDidFinishLaunchingWithOptionsObjc(contents, iOSEnableMultitaskingCam
119
127
  }
120
128
  return contents;
121
129
  }
122
- function addDidFinishLaunchingWithOptionsRingingSwift(contents) {
130
+ function addDidFinishLaunchingWithOptionsRingingSwift(contents, ringingPushNotifications) {
123
131
  const functionSelector = 'application(_:didFinishLaunchingWithOptions:)';
132
+ const supportsVideoString = ringingPushNotifications.disableVideoIos
133
+ ? 'false'
134
+ : 'true';
135
+ const includesCallsInRecents = ringingPushNotifications.includesCallsInRecentsIos ? 'false' : 'true';
136
+ const setupCallKeep = ` let localizedAppName = Bundle.main.localizedInfoDictionary?["CFBundleDisplayName"] as? String
137
+ let appName = Bundle.main.infoDictionary?["CFBundleDisplayName"] as? String
138
+ RNCallKeep.setup([
139
+ "appName": localizedAppName != nil ? localizedAppName! : appName as Any,
140
+ "supportsVideo": ${supportsVideoString},
141
+ "includesCallsInRecents": ${includesCallsInRecents},
142
+ ])`;
143
+ if (!contents.includes('RNCallKeep.setup')) {
144
+ contents = (0, codeMod_1.insertContentsInsideSwiftFunctionBlock)(contents, functionSelector, setupCallKeep, { position: 'head' });
145
+ }
124
146
  // call the setup of voip push notification
125
- const voipSetupMethod = 'StreamVideoReactNative.voipRegistration()';
147
+ const voipSetupMethod = 'RNVoipPushNotificationManager.voipRegistration()';
126
148
  if (!contents.includes(voipSetupMethod)) {
127
149
  contents = (0, codeMod_1.insertContentsInsideSwiftFunctionBlock)(contents, functionSelector, ' ' /* indentation */ + voipSetupMethod, { position: 'head' });
128
150
  }
129
151
  return contents;
130
152
  }
131
- function addDidFinishLaunchingWithOptionsRingingObjc(contents) {
153
+ function addDidFinishLaunchingWithOptionsRingingObjc(contents, ringingPushNotifications) {
132
154
  const functionSelector = 'application:didFinishLaunchingWithOptions:';
155
+ // call the setup RNCallKeep
156
+ const supportsVideoString = ringingPushNotifications.disableVideoIos
157
+ ? '@NO'
158
+ : '@YES';
159
+ const includesCallsInRecents = ringingPushNotifications.includesCallsInRecentsIos ? '@YES' : '@NO';
160
+ const setupCallKeep = `NSString *localizedAppName = [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"];
161
+ NSString *appName = [[[NSBundle mainBundle] infoDictionary]objectForKey :@"CFBundleDisplayName"];
162
+ [RNCallKeep setup:@{
163
+ @"appName": localizedAppName != nil ? localizedAppName : appName,
164
+ @"supportsVideo": ${supportsVideoString},
165
+ @"includesCallsInRecents": ${includesCallsInRecents},
166
+ }];`;
167
+ if (!contents.includes('[RNCallKeep setup:@')) {
168
+ contents = (0, codeMod_1.insertContentsInsideObjcFunctionBlock)(contents, functionSelector, setupCallKeep, { position: 'head' });
169
+ }
133
170
  // call the setup of voip push notification
134
- const voipSetupMethod = '[StreamVideoReactNative voipRegistration];';
171
+ const voipSetupMethod = '[RNVoipPushNotificationManager voipRegistration];';
135
172
  if (!contents.includes(voipSetupMethod)) {
136
173
  contents = (0, codeMod_1.insertContentsInsideObjcFunctionBlock)(contents, functionSelector, voipSetupMethod, { position: 'head' });
137
174
  }
138
175
  return contents;
139
176
  }
140
177
  function addDidUpdatePushCredentialsSwift(contents) {
141
- const updatedPushCredentialsMethod = 'StreamVideoReactNative.didUpdate(credentials, forType: type.rawValue)';
178
+ const updatedPushCredentialsMethod = 'RNVoipPushNotificationManager.didUpdate(credentials, forType: type.rawValue)';
142
179
  if (!contents.includes(updatedPushCredentialsMethod)) {
143
180
  const functionSelector = 'pushRegistry(_:didUpdate:for:)';
144
181
  const codeblock = (0, codeMod_1.findSwiftFunctionCodeBlock)(contents, functionSelector);
@@ -160,7 +197,7 @@ function addDidUpdatePushCredentialsSwift(contents) {
160
197
  return contents;
161
198
  }
162
199
  function addDidUpdatePushCredentialsObjc(contents) {
163
- const updatedPushCredentialsMethod = '[StreamVideoReactNative didUpdatePushCredentials:credentials forType: (NSString *) type];';
200
+ const updatedPushCredentialsMethod = '[RNVoipPushNotificationManager didUpdatePushCredentials:credentials forType:(NSString *)type];';
164
201
  if (!contents.includes(updatedPushCredentialsMethod)) {
165
202
  const functionSelector = 'pushRegistry:didUpdatePushCredentials:forType:';
166
203
  const codeblock = (0, codeMod_1.findObjcFunctionCodeBlock)(contents, functionSelector);
@@ -177,10 +214,112 @@ function addDidUpdatePushCredentialsObjc(contents) {
177
214
  }
178
215
  return contents;
179
216
  }
217
+ function addAudioSessionMethodsSwift(contents) {
218
+ const audioSessionDidActivateMethod = 'RTCAudioSession.sharedInstance().audioSessionDidActivate(AVAudioSession.sharedInstance())';
219
+ if (!contents.includes(audioSessionDidActivateMethod)) {
220
+ const functionSelector = 'provider(_:didActivate:)';
221
+ if (!contents.includes('didActivateAudioSession')) {
222
+ contents = (0, codeMod_1.insertContentsInsideSwiftClassBlock)(contents, 'class AppDelegate', `
223
+ func provider(_ provider: CXProvider, didActivateAudioSession audioSession: AVAudioSession) {
224
+ ${audioSessionDidActivateMethod}
225
+ }
226
+ `, { position: 'tail' });
227
+ }
228
+ else {
229
+ contents = (0, codeMod_1.insertContentsInsideSwiftFunctionBlock)(contents, functionSelector, audioSessionDidActivateMethod, { position: 'tail' });
230
+ }
231
+ }
232
+ const audioSessionDidDeactivateMethod = 'RTCAudioSession.sharedInstance().audioSessionDidDeactivate(AVAudioSession.sharedInstance())';
233
+ if (!contents.includes(audioSessionDidDeactivateMethod)) {
234
+ const functionSelector = 'provider(_:didDeactivate:)';
235
+ if (!contents.includes('didDeactivateAudioSession')) {
236
+ contents = (0, codeMod_1.insertContentsInsideSwiftClassBlock)(contents, 'class AppDelegate', `
237
+ func provider(_ provider: CXProvider, didDeactivateAudioSession audioSession: AVAudioSession) {
238
+ ${audioSessionDidDeactivateMethod}
239
+ }
240
+ `, { position: 'tail' });
241
+ }
242
+ else {
243
+ contents = (0, codeMod_1.insertContentsInsideSwiftFunctionBlock)(contents, functionSelector, audioSessionDidDeactivateMethod, { position: 'tail' });
244
+ }
245
+ }
246
+ return contents;
247
+ }
248
+ function addAudioSessionMethodsObjc(contents) {
249
+ const audioSessionDidActivateMethod = '[[RTCAudioSession sharedInstance] audioSessionDidActivate:[AVAudioSession sharedInstance]];';
250
+ if (!contents.includes(audioSessionDidActivateMethod)) {
251
+ const functionSelector = 'provider:didActivateAudioSession:audioSession:';
252
+ const codeblock = (0, codeMod_1.findObjcFunctionCodeBlock)(contents, functionSelector);
253
+ if (!codeblock) {
254
+ contents = (0, addNewLinesToAppDelegateObjc_1.default)(contents, [
255
+ '- (void) provider:(CXProvider *) provider didActivateAudioSession:(AVAudioSession *) audioSession {',
256
+ ' ' /* indentation */ + audioSessionDidActivateMethod,
257
+ '}',
258
+ ]);
259
+ }
260
+ else {
261
+ contents = (0, codeMod_1.insertContentsInsideObjcFunctionBlock)(contents, functionSelector, audioSessionDidActivateMethod, { position: 'tail' });
262
+ }
263
+ }
264
+ const audioSessionDidDeactivateMethod = '[[RTCAudioSession sharedInstance] audioSessionDidDeactivate:[AVAudioSession sharedInstance]];';
265
+ if (!contents.includes(audioSessionDidDeactivateMethod)) {
266
+ const functionSelector = 'provider:didDeactivateAudioSession:audioSession:';
267
+ const codeblock = (0, codeMod_1.findObjcFunctionCodeBlock)(contents, functionSelector);
268
+ if (!codeblock) {
269
+ contents = (0, addNewLinesToAppDelegateObjc_1.default)(contents, [
270
+ '- (void) provider:(CXProvider *) provider didDeactivateAudioSession:(AVAudioSession *) audioSession {',
271
+ ' ' /* indentation */ + audioSessionDidDeactivateMethod,
272
+ '}',
273
+ ]);
274
+ }
275
+ else {
276
+ contents = (0, codeMod_1.insertContentsInsideObjcFunctionBlock)(contents, functionSelector, audioSessionDidDeactivateMethod, { position: 'tail' });
277
+ }
278
+ }
279
+ return contents;
280
+ }
180
281
  function addDidReceiveIncomingPushCallbackSwift(contents) {
181
282
  const onIncomingPush = `
182
- StreamVideoReactNative.didReceiveIncomingPush(payload, forType: type.rawValue, completionHandler: completion)`;
183
- if (!contents.includes('StreamVideoReactNative.didReceiveIncomingPush')) {
283
+ guard let stream = payload.dictionaryPayload["stream"] as? [String: Any],
284
+ let createdCallerName = stream["created_by_display_name"] as? String,
285
+ let cid = stream["call_cid"] as? String else {
286
+ completion()
287
+ return
288
+ }
289
+
290
+ // Check if user is busy BEFORE registering the call
291
+ let shouldReject = StreamVideoReactNative.shouldRejectCallWhenBusy()
292
+ let hasAnyActiveCall = StreamVideoReactNative.hasAnyActiveCall()
293
+
294
+ if shouldReject && hasAnyActiveCall {
295
+ // Complete the VoIP notification without showing CallKit UI
296
+ completion()
297
+ return
298
+ }
299
+
300
+ let uuid = UUID().uuidString
301
+ let videoIncluded = stream["video"] as? String
302
+ let hasVideo = videoIncluded == "false" ? false : true
303
+
304
+ StreamVideoReactNative.registerIncomingCall(cid, uuid: uuid)
305
+
306
+ RNVoipPushNotificationManager.addCompletionHandler(uuid, completionHandler: completion)
307
+
308
+ RNVoipPushNotificationManager.didReceiveIncomingPush(with: payload, forType: type.rawValue)
309
+
310
+ RNCallKeep.reportNewIncomingCall(uuid,
311
+ handle: createdCallerName,
312
+ handleType: "generic",
313
+ hasVideo: hasVideo,
314
+ localizedCallerName: createdCallerName,
315
+ supportsHolding: false,
316
+ supportsDTMF: false,
317
+ supportsGrouping: false,
318
+ supportsUngrouping: false,
319
+ fromPushKit: true,
320
+ payload: stream,
321
+ withCompletionHandler: nil)`;
322
+ if (!contents.includes('RNVoipPushNotificationManager.didReceiveIncomingPush')) {
184
323
  const functionSelector = 'pushRegistry(_:didReceiveIncomingPushWith:for:completion:)';
185
324
  const codeblock = (0, codeMod_1.findSwiftFunctionCodeBlock)(contents, functionSelector);
186
325
  if (!codeblock) {
@@ -203,10 +342,49 @@ function addDidReceiveIncomingPushCallbackSwift(contents) {
203
342
  }
204
343
  function addDidReceiveIncomingPushCallbackObjc(contents) {
205
344
  const onIncomingPush = `
206
- // process the payload and display the incoming call notification
207
- [StreamVideoReactNative didReceiveIncomingPush:payload forType: (NSString *)type completionHandler:completion];
345
+ // process the payload and store it in the native module's cache
346
+ NSDictionary *stream = payload.dictionaryPayload[@"stream"];
347
+ NSString *uuid = [[NSUUID UUID] UUIDString];
348
+ NSString *createdCallerName = stream[@"created_by_display_name"];
349
+ NSString *cid = stream[@"call_cid"];
350
+
351
+ // Check if user is busy BEFORE registering the call
352
+ BOOL shouldReject = [StreamVideoReactNative shouldRejectCallWhenBusy];
353
+ BOOL hasAnyActiveCall = [StreamVideoReactNative hasAnyActiveCall];
354
+
355
+ if (shouldReject && hasAnyActiveCall) {
356
+ // Complete the VoIP notification without showing CallKit UI
357
+ completion();
358
+ return;
359
+ }
360
+
361
+ NSString *videoIncluded = stream[@"video"];
362
+ BOOL hasVideo = [videoIncluded isEqualToString:@"false"] ? NO : YES;
363
+
364
+ // store the call cid and uuid in the native module's cache
365
+ [StreamVideoReactNative registerIncomingCall:cid uuid:uuid];
366
+
367
+ // set the completion handler - this one is called by the JS SDK
368
+ [RNVoipPushNotificationManager addCompletionHandler:uuid completionHandler:completion];
369
+
370
+ // send event to JS - the JS SDK will handle the rest and call the 'completionHandler'
371
+ [RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
372
+
373
+ // display the incoming call notification
374
+ [RNCallKeep reportNewIncomingCall: uuid
375
+ handle: createdCallerName
376
+ handleType: @"generic"
377
+ hasVideo: hasVideo
378
+ localizedCallerName: createdCallerName
379
+ supportsHolding: NO
380
+ supportsDTMF: NO
381
+ supportsGrouping: NO
382
+ supportsUngrouping: NO
383
+ fromPushKit: YES
384
+ payload: stream
385
+ withCompletionHandler: nil];
208
386
  `;
209
- if (!contents.includes('[StreamVideoReactNative didReceiveIncomingPush')) {
387
+ if (!contents.includes('[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload')) {
210
388
  const functionSelector = 'pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:';
211
389
  const codeblock = (0, codeMod_1.findObjcFunctionCodeBlock)(contents, functionSelector);
212
390
  if (!codeblock) {
@@ -23,7 +23,7 @@ const withStreamVideoReactNativeSDKMainActivity = (configuration, props) => {
23
23
  if (props?.enableScreenshare) {
24
24
  config.modResults.contents = addInsideOnCreateScreenshare(config.modResults.contents, isMainActivityJava);
25
25
  }
26
- if (props?.ringing) {
26
+ if (props?.ringingPushNotifications?.showWhenLockedAndroid) {
27
27
  config.modResults.contents = addInsideOnCreateLockscreen(config.modResults.contents, isMainActivityJava);
28
28
  }
29
29
  return config;
@@ -12,7 +12,7 @@ const withStreamVideoReactNativeSDKiOSInfoPList = (configuration, props) => {
12
12
  }
13
13
  }
14
14
  addBackgroundMode('audio');
15
- if (props?.ringing) {
15
+ if (props?.ringingPushNotifications) {
16
16
  addBackgroundMode('voip');
17
17
  addBackgroundMode('fetch');
18
18
  addBackgroundMode('processing');
@@ -20,7 +20,8 @@ const withStreamVideoReactNativeSDKiOSInfoPList = (configuration, props) => {
20
20
  '$(PRODUCT_BUNDLE_IDENTIFIER)',
21
21
  ];
22
22
  }
23
- if (props?.enableNonRingingPushNotifications || props?.ringing) {
23
+ if (props?.enableNonRingingPushNotifications ||
24
+ props?.ringingPushNotifications) {
24
25
  addBackgroundMode('remote-notification');
25
26
  }
26
27
  return config;
@@ -23,8 +23,6 @@ RCT_EXTERN_METHOD(setMicrophoneMute:(BOOL)enable)
23
23
 
24
24
  RCT_EXTERN_METHOD(logAudioState)
25
25
 
26
- RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getAudioStateLog)
27
-
28
26
  RCT_EXTERN_METHOD(muteAudioOutput)
29
27
 
30
28
  RCT_EXTERN_METHOD(unmuteAudioOutput)