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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/android/src/main/AndroidManifest.xml +8 -1
  2. package/android/src/main/AndroidManifestNew.xml +11 -0
  3. package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +42 -5
  4. package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +83 -0
  5. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +134 -0
  6. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +235 -0
  7. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  8. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  9. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  10. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +60 -97
  11. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  12. package/dist/commonjs/index.js +1 -0
  13. package/dist/commonjs/index.js.map +1 -1
  14. package/dist/commonjs/modules/call-manager/CallManager.js +20 -0
  15. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  16. package/dist/commonjs/providers/StreamCall/index.js +6 -6
  17. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  18. package/dist/commonjs/utils/StreamVideoRN/index.js +33 -21
  19. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  20. package/dist/commonjs/utils/internal/registerSDKGlobals.js +47 -3
  21. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  22. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +48 -0
  23. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +1 -0
  24. package/dist/commonjs/utils/push/android.js +145 -200
  25. package/dist/commonjs/utils/push/android.js.map +1 -1
  26. package/dist/commonjs/utils/push/internal/ios.js +16 -34
  27. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  28. package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -20
  29. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  30. package/dist/commonjs/utils/push/internal/utils.js +17 -1
  31. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  32. package/dist/commonjs/utils/push/ios.js.map +1 -1
  33. package/dist/commonjs/utils/push/libs/callingx.js +75 -0
  34. package/dist/commonjs/utils/push/libs/callingx.js.map +1 -0
  35. package/dist/commonjs/utils/push/libs/index.js +8 -19
  36. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  37. package/dist/commonjs/utils/push/libs/notifee/index.js +0 -19
  38. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  39. package/dist/commonjs/utils/push/setupCallingExpEvents.js +75 -0
  40. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -0
  41. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +7 -6
  42. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  43. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +228 -0
  44. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  45. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  46. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  47. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +62 -99
  48. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  49. package/dist/module/index.js +1 -0
  50. package/dist/module/index.js.map +1 -1
  51. package/dist/module/modules/call-manager/CallManager.js +20 -0
  52. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  53. package/dist/module/providers/StreamCall/index.js +6 -6
  54. package/dist/module/providers/StreamCall/index.js.map +1 -1
  55. package/dist/module/utils/StreamVideoRN/index.js +33 -21
  56. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  57. package/dist/module/utils/internal/registerSDKGlobals.js +48 -4
  58. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  59. package/dist/module/utils/keepCallAliveHeadlessTask.js +42 -0
  60. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +1 -0
  61. package/dist/module/utils/push/android.js +147 -202
  62. package/dist/module/utils/push/android.js.map +1 -1
  63. package/dist/module/utils/push/internal/ios.js +16 -34
  64. package/dist/module/utils/push/internal/ios.js.map +1 -1
  65. package/dist/module/utils/push/internal/rxSubjects.js +0 -19
  66. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  67. package/dist/module/utils/push/internal/utils.js +14 -0
  68. package/dist/module/utils/push/internal/utils.js.map +1 -1
  69. package/dist/module/utils/push/ios.js.map +1 -1
  70. package/dist/module/utils/push/libs/callingx.js +67 -0
  71. package/dist/module/utils/push/libs/callingx.js.map +1 -0
  72. package/dist/module/utils/push/libs/index.js +1 -2
  73. package/dist/module/utils/push/libs/index.js.map +1 -1
  74. package/dist/module/utils/push/libs/notifee/index.js +0 -18
  75. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  76. package/dist/module/utils/push/setupCallingExpEvents.js +69 -0
  77. package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -0
  78. package/dist/module/utils/push/setupIosVoipPushEvents.js +7 -6
  79. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  80. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +5 -0
  81. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -0
  82. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  83. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  84. package/dist/typescript/index.d.ts +1 -0
  85. package/dist/typescript/index.d.ts.map +1 -1
  86. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  87. package/dist/typescript/utils/StreamVideoRN/index.d.ts +20 -2
  88. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  89. package/dist/typescript/utils/StreamVideoRN/types.d.ts +54 -29
  90. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  91. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  92. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +10 -0
  93. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +1 -0
  94. package/dist/typescript/utils/push/android.d.ts +1 -2
  95. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  96. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  97. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -12
  98. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  99. package/dist/typescript/utils/push/internal/utils.d.ts +4 -0
  100. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  101. package/dist/typescript/utils/push/ios.d.ts +1 -2
  102. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  103. package/dist/typescript/utils/push/libs/callingx.d.ts +9 -0
  104. package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -0
  105. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts +16 -2
  106. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
  107. package/dist/typescript/utils/push/libs/index.d.ts +1 -2
  108. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  109. package/dist/typescript/utils/push/libs/notifee/index.d.ts +0 -1
  110. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  111. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +8 -0
  112. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -0
  113. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  114. package/expo-config-plugin/dist/withAndroidManifest.js +1 -33
  115. package/expo-config-plugin/dist/withAndroidPermissions.js +2 -7
  116. package/expo-config-plugin/dist/withAppDelegate.js +19 -197
  117. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  118. package/expo-config-plugin/dist/withiOSInfoPlist.js +2 -3
  119. package/ios/StreamInCallManager.swift +4 -0
  120. package/ios/StreamVideoReactNative.h +7 -4
  121. package/ios/StreamVideoReactNative.m +191 -82
  122. package/package.json +10 -15
  123. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +361 -0
  124. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +21 -34
  125. package/src/hooks/useAndroidKeepCallAliveEffect.ts +95 -120
  126. package/src/index.ts +1 -0
  127. package/src/modules/call-manager/CallManager.ts +30 -0
  128. package/src/providers/StreamCall/index.tsx +6 -6
  129. package/src/utils/StreamVideoRN/index.ts +40 -30
  130. package/src/utils/StreamVideoRN/types.ts +56 -29
  131. package/src/utils/internal/registerSDKGlobals.ts +42 -4
  132. package/src/utils/keepCallAliveHeadlessTask.ts +54 -0
  133. package/src/utils/push/android.ts +223 -308
  134. package/src/utils/push/internal/ios.ts +25 -46
  135. package/src/utils/push/internal/rxSubjects.ts +0 -29
  136. package/src/utils/push/internal/utils.ts +25 -0
  137. package/src/utils/push/ios.ts +1 -6
  138. package/src/utils/push/libs/callingx.ts +90 -0
  139. package/src/utils/push/libs/index.ts +1 -2
  140. package/src/utils/push/libs/notifee/index.ts +0 -27
  141. package/src/utils/push/setupCallingExpEvents.ts +100 -0
  142. package/src/utils/push/setupIosVoipPushEvents.ts +11 -7
  143. package/CHANGELOG.md +0 -3089
  144. package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +0 -95
  145. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -160
  146. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  147. package/dist/commonjs/utils/push/libs/callkeep.js +0 -17
  148. package/dist/commonjs/utils/push/libs/callkeep.js.map +0 -1
  149. package/dist/commonjs/utils/push/libs/voipPushNotification.js +0 -17
  150. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +0 -1
  151. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +0 -205
  152. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +0 -1
  153. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -153
  154. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  155. package/dist/module/utils/push/libs/callkeep.js +0 -11
  156. package/dist/module/utils/push/libs/callkeep.js.map +0 -1
  157. package/dist/module/utils/push/libs/voipPushNotification.js +0 -11
  158. package/dist/module/utils/push/libs/voipPushNotification.js.map +0 -1
  159. package/dist/module/utils/push/setupIosCallKeepEvents.js +0 -199
  160. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +0 -1
  161. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +0 -5
  162. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +0 -1
  163. package/dist/typescript/utils/push/libs/callkeep.d.ts +0 -3
  164. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +0 -1
  165. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +0 -3
  166. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +0 -1
  167. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +0 -6
  168. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +0 -1
  169. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +0 -235
  170. package/src/utils/push/libs/callkeep.ts +0 -16
  171. package/src/utils/push/libs/voipPushNotification.ts +0 -17
  172. package/src/utils/push/setupIosCallKeepEvents.ts +0 -252
@@ -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?.ringingPushNotifications &&
12
+ if (!props?.ringing &&
13
13
  !props?.iOSEnableMultitaskingCameraAccess &&
14
14
  !props?.addNoiseCancellation) {
15
15
  // quit early if no change is necessary
@@ -21,19 +21,12 @@ 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?.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
- ]);
24
+ if (props?.ringing) {
25
+ config.modResults.contents = (0, codeMod_1.addObjcImports)(config.modResults.contents, ['<PushKit/PushKit.h>', '"StreamVideoReactNative.h"']);
32
26
  config.modResults.contents =
33
- addDidFinishLaunchingWithOptionsRingingObjc(config.modResults.contents, props.ringingPushNotifications);
27
+ addDidFinishLaunchingWithOptionsRingingObjc(config.modResults.contents);
34
28
  config.modResults.contents = addDidUpdatePushCredentialsObjc(config.modResults.contents);
35
29
  config.modResults.contents = addDidReceiveIncomingPushCallbackObjc(config.modResults.contents);
36
- config.modResults.contents = addAudioSessionMethodsObjc(config.modResults.contents);
37
30
  }
38
31
  return config;
39
32
  }
@@ -43,7 +36,7 @@ const withAppDelegate = (configuration, props) => {
43
36
  }
44
37
  else {
45
38
  try {
46
- if (props?.ringingPushNotifications) {
39
+ if (props?.ringing) {
47
40
  // make it public class AppDelegate: ExpoAppDelegate, PKPushRegistryDelegate {
48
41
  const regex = /(class\s+AppDelegate[^{]*)(\s*\{)/;
49
42
  config.modResults.contents = config.modResults.contents.replace(regex, (match, declarationPart, openBrace) => {
@@ -76,13 +69,12 @@ const withAppDelegate = (configuration, props) => {
76
69
  config.modResults.contents = (0, codeMod_1.addSwiftImports)(config.modResults.contents, ['stream_io_noise_cancellation_react_native']);
77
70
  }
78
71
  config.modResults.contents = addDidFinishLaunchingWithOptionsSwift(config.modResults.contents, props.iOSEnableMultitaskingCameraAccess, props.addNoiseCancellation);
79
- if (props?.ringingPushNotifications) {
80
- config.modResults.contents = (0, codeMod_1.addSwiftImports)(config.modResults.contents, ['RNCallKeep', 'PushKit', 'RNVoipPushNotification']);
72
+ if (props?.ringing) {
73
+ config.modResults.contents = (0, codeMod_1.addSwiftImports)(config.modResults.contents, ['PushKit', 'stream_video_react_native']);
81
74
  config.modResults.contents =
82
- addDidFinishLaunchingWithOptionsRingingSwift(config.modResults.contents, props.ringingPushNotifications);
75
+ addDidFinishLaunchingWithOptionsRingingSwift(config.modResults.contents);
83
76
  config.modResults.contents = addDidUpdatePushCredentialsSwift(config.modResults.contents);
84
77
  config.modResults.contents = addDidReceiveIncomingPushCallbackSwift(config.modResults.contents);
85
- config.modResults.contents = addAudioSessionMethodsSwift(config.modResults.contents);
86
78
  }
87
79
  return config;
88
80
  }
@@ -127,55 +119,26 @@ function addDidFinishLaunchingWithOptionsObjc(contents, iOSEnableMultitaskingCam
127
119
  }
128
120
  return contents;
129
121
  }
130
- function addDidFinishLaunchingWithOptionsRingingSwift(contents, ringingPushNotifications) {
122
+ function addDidFinishLaunchingWithOptionsRingingSwift(contents) {
131
123
  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
- }
146
124
  // call the setup of voip push notification
147
- const voipSetupMethod = 'RNVoipPushNotificationManager.voipRegistration()';
125
+ const voipSetupMethod = 'StreamVideoReactNative.voipRegistration()';
148
126
  if (!contents.includes(voipSetupMethod)) {
149
127
  contents = (0, codeMod_1.insertContentsInsideSwiftFunctionBlock)(contents, functionSelector, ' ' /* indentation */ + voipSetupMethod, { position: 'head' });
150
128
  }
151
129
  return contents;
152
130
  }
153
- function addDidFinishLaunchingWithOptionsRingingObjc(contents, ringingPushNotifications) {
131
+ function addDidFinishLaunchingWithOptionsRingingObjc(contents) {
154
132
  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
- }
170
133
  // call the setup of voip push notification
171
- const voipSetupMethod = '[RNVoipPushNotificationManager voipRegistration];';
134
+ const voipSetupMethod = '[StreamVideoReactNative voipRegistration];';
172
135
  if (!contents.includes(voipSetupMethod)) {
173
136
  contents = (0, codeMod_1.insertContentsInsideObjcFunctionBlock)(contents, functionSelector, voipSetupMethod, { position: 'head' });
174
137
  }
175
138
  return contents;
176
139
  }
177
140
  function addDidUpdatePushCredentialsSwift(contents) {
178
- const updatedPushCredentialsMethod = 'RNVoipPushNotificationManager.didUpdate(credentials, forType: type.rawValue)';
141
+ const updatedPushCredentialsMethod = 'StreamVideoReactNative.didUpdate(credentials, forType: type.rawValue)';
179
142
  if (!contents.includes(updatedPushCredentialsMethod)) {
180
143
  const functionSelector = 'pushRegistry(_:didUpdate:for:)';
181
144
  const codeblock = (0, codeMod_1.findSwiftFunctionCodeBlock)(contents, functionSelector);
@@ -197,7 +160,7 @@ function addDidUpdatePushCredentialsSwift(contents) {
197
160
  return contents;
198
161
  }
199
162
  function addDidUpdatePushCredentialsObjc(contents) {
200
- const updatedPushCredentialsMethod = '[RNVoipPushNotificationManager didUpdatePushCredentials:credentials forType:(NSString *)type];';
163
+ const updatedPushCredentialsMethod = '[StreamVideoReactNative didUpdatePushCredentials:credentials forType: (NSString *) type];';
201
164
  if (!contents.includes(updatedPushCredentialsMethod)) {
202
165
  const functionSelector = 'pushRegistry:didUpdatePushCredentials:forType:';
203
166
  const codeblock = (0, codeMod_1.findObjcFunctionCodeBlock)(contents, functionSelector);
@@ -214,112 +177,10 @@ function addDidUpdatePushCredentialsObjc(contents) {
214
177
  }
215
178
  return contents;
216
179
  }
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
- }
281
180
  function addDidReceiveIncomingPushCallbackSwift(contents) {
282
181
  const onIncomingPush = `
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')) {
182
+ StreamVideoReactNative.didReceiveIncomingPush(payload, forType: type.rawValue, completionHandler: completion)`;
183
+ if (!contents.includes('StreamVideoReactNative.didReceiveIncomingPush')) {
323
184
  const functionSelector = 'pushRegistry(_:didReceiveIncomingPushWith:for:completion:)';
324
185
  const codeblock = (0, codeMod_1.findSwiftFunctionCodeBlock)(contents, functionSelector);
325
186
  if (!codeblock) {
@@ -342,49 +203,10 @@ function addDidReceiveIncomingPushCallbackSwift(contents) {
342
203
  }
343
204
  function addDidReceiveIncomingPushCallbackObjc(contents) {
344
205
  const onIncomingPush = `
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];
206
+ // process the payload and display the incoming call notification
207
+ [StreamVideoReactNative didReceiveIncomingPush:payload forType: (NSString *)type completionHandler:completion];
386
208
  `;
387
- if (!contents.includes('[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload')) {
209
+ if (!contents.includes('[StreamVideoReactNative didReceiveIncomingPush')) {
388
210
  const functionSelector = 'pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:';
389
211
  const codeblock = (0, codeMod_1.findObjcFunctionCodeBlock)(contents, functionSelector);
390
212
  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?.ringingPushNotifications?.showWhenLockedAndroid) {
26
+ if (props?.ringing) {
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?.ringingPushNotifications) {
15
+ if (props?.ringing) {
16
16
  addBackgroundMode('voip');
17
17
  addBackgroundMode('fetch');
18
18
  addBackgroundMode('processing');
@@ -20,8 +20,7 @@ const withStreamVideoReactNativeSDKiOSInfoPList = (configuration, props) => {
20
20
  '$(PRODUCT_BUNDLE_IDENTIFIER)',
21
21
  ];
22
22
  }
23
- if (props?.enableNonRingingPushNotifications ||
24
- props?.ringingPushNotifications) {
23
+ if (props?.enableNonRingingPushNotifications || props?.ringing) {
25
24
  addBackgroundMode('remote-notification');
26
25
  }
27
26
  return config;
@@ -132,6 +132,7 @@ class StreamInCallManager: RCTEventEmitter {
132
132
  rtcConfig.category = intendedCategory.rawValue
133
133
  rtcConfig.mode = intendedMode.rawValue
134
134
  rtcConfig.categoryOptions = intendedOptions
135
+ // This ensures WebRTC's internal state stays consistent during interruptions/route changes
135
136
  RTCAudioSessionConfiguration.setWebRTC(rtcConfig)
136
137
 
137
138
  let session = RTCAudioSession.sharedInstance()
@@ -141,6 +142,9 @@ class StreamInCallManager: RCTEventEmitter {
141
142
  }
142
143
  do {
143
144
  try session.setCategory(intendedCategory, mode: intendedMode, options: intendedOptions)
145
+ // Apply sample rate and IO buffer duration from WebRTC's config
146
+ try session.setPreferredSampleRate(rtcConfig.sampleRate)
147
+ try session.setPreferredIOBufferDuration(rtcConfig.ioBufferDuration)
144
148
  if (wasRecording) {
145
149
  try adm.setRecording(wasRecording)
146
150
  }
@@ -1,16 +1,19 @@
1
1
  #import <React/RCTEventEmitter.h>
2
2
  #import <React/RCTBridge.h>
3
+ #import <PushKit/PushKit.h>
3
4
 
4
5
  @interface StreamVideoReactNative : RCTEventEmitter <RCTBridgeModule>
5
6
 
6
7
  - (void)screenShareEventReceived:(NSString *)event;
7
8
 
8
- + (void)registerIncomingCall:(NSString *)cid uuid:(NSString *)uuid;
9
-
10
9
  + (void)setup DEPRECATED_MSG_ATTRIBUTE("No need to use setup() anymore");
11
10
 
12
- + (BOOL)shouldRejectCallWhenBusy;
13
-
14
11
  + (BOOL)hasAnyActiveCall;
15
12
 
13
+ + (void)voipRegistration;
14
+
15
+ + (void)didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type;
16
+
17
+ + (void)didReceiveIncomingPush:(PKPushPayload *)payload forType:(NSString *)type completionHandler: (void (^_Nullable)(void)) completion;
18
+
16
19
  @end
@@ -4,6 +4,7 @@
4
4
  #import <React/RCTUIManagerUtils.h>
5
5
  #import <UIKit/UIKit.h>
6
6
  #import <CallKit/CallKit.h>
7
+ #import <PushKit/PushKit.h>
7
8
  #import "StreamVideoReactNative.h"
8
9
  #import "WebRTCModule.h"
9
10
  #import "WebRTCModuleOptions.h"
@@ -14,12 +15,8 @@
14
15
  NSNotificationName const kBroadcastStartedNotification = @"iOS_BroadcastStarted";
15
16
  NSNotificationName const kBroadcastStoppedNotification = @"iOS_BroadcastStopped";
16
17
 
17
- static NSMutableDictionary *_incomingCallUUIDsByCallID = nil;
18
- static NSMutableDictionary *_incomingCallCidsByUUID = nil;
19
18
  static dispatch_queue_t _dictionaryQueue = nil;
20
19
 
21
- static BOOL _shouldRejectCallWhenBusy = NO;
22
-
23
20
  void broadcastNotificationCallback(CFNotificationCenterRef center,
24
21
  void *observer,
25
22
  CFStringRef name,
@@ -60,11 +57,198 @@ RCT_EXPORT_MODULE();
60
57
  static dispatch_once_t onceToken;
61
58
  dispatch_once(&onceToken, ^{
62
59
  _dictionaryQueue = dispatch_queue_create("com.stream.video.dictionary", DISPATCH_QUEUE_SERIAL);
63
- _incomingCallUUIDsByCallID = [NSMutableDictionary dictionary];
64
- _incomingCallCidsByUUID = [NSMutableDictionary dictionary];
65
60
  });
66
61
  }
67
62
 
63
+ +(BOOL)canRegisterCall {
64
+ Class callingxClass = NSClassFromString(@"Callingx");
65
+ if (!callingxClass) {
66
+ #if DEBUG
67
+ NSLog(@"[StreamVideoReactNative][canRegisterCall] Callingx not available");
68
+ #endif
69
+ return YES;
70
+ }
71
+
72
+ SEL selector = @selector(canRegisterCall);
73
+ if (![callingxClass respondsToSelector:selector]) {
74
+ #if DEBUG
75
+ NSLog(@"[StreamVideoReactNative][canRegisterCall] Callingx does not respond to canRegisterCall selector");
76
+ #endif
77
+ return YES;
78
+ }
79
+
80
+ NSMethodSignature *signature = [callingxClass methodSignatureForSelector:selector];
81
+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
82
+ [invocation setTarget:callingxClass];
83
+ [invocation setSelector:selector];
84
+ [invocation invoke];
85
+
86
+ BOOL canRegister = NO;
87
+ [invocation getReturnValue:&canRegister];
88
+
89
+ #if DEBUG
90
+ NSLog(@"[StreamVideoReactNative][canRegisterCall] canRegisterCall = %@", canRegister ? @"YES" : @"NO");
91
+ #endif
92
+
93
+ return canRegister;
94
+ }
95
+
96
+ +(void)voipRegistration {
97
+ Class voipManagerClass = NSClassFromString(@"Callingx.VoipNotificationsManager");
98
+ if (!voipManagerClass) {
99
+ // Fallback: Try the unmangled name (might work depending on Swift version)
100
+ voipManagerClass = NSClassFromString(@"VoipNotificationsManager");
101
+ }
102
+
103
+ if (!voipManagerClass) {
104
+ #if DEBUG
105
+ NSLog(@"[StreamVideoReactNative][voipRegistration] VoipNotificationsManager not available");
106
+ #endif
107
+ return;
108
+ }
109
+
110
+ SEL selector = @selector(voipRegistration);
111
+ if (![voipManagerClass respondsToSelector:selector]) {
112
+ #if DEBUG
113
+ NSLog(@"[StreamVideoReactNative][voipRegistration] VoipNotificationsManager does not respond to voipRegistration");
114
+ #endif
115
+ return;
116
+ }
117
+
118
+ [voipManagerClass voipRegistration];
119
+ }
120
+
121
+ +(void)didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type {
122
+ Class voipManagerClass = NSClassFromString(@"Callingx.VoipNotificationsManager");
123
+ if (!voipManagerClass) {
124
+ // Fallback: Try the unmangled name (might work depending on Swift version)
125
+ voipManagerClass = NSClassFromString(@"VoipNotificationsManager");
126
+ }
127
+
128
+ if (!voipManagerClass) {
129
+ #if DEBUG
130
+ NSLog(@"[StreamVideoReactNative][didUpdatePushCredentials] VoipNotificationsManager not available");
131
+ #endif
132
+ return;
133
+ }
134
+
135
+ SEL selector = @selector(didUpdatePushCredentials:forType:);
136
+ if (![voipManagerClass respondsToSelector:selector]) {
137
+ #if DEBUG
138
+ NSLog(@"[StreamVideoReactNative][didUpdatePushCredentials] VoipNotificationsManager does not respond to didUpdatePushCredentials:forType:");
139
+ #endif
140
+ return;
141
+ }
142
+
143
+ [voipManagerClass didUpdatePushCredentials:credentials forType:type];
144
+ }
145
+
146
+ +(void)didReceiveIncomingPush:(PKPushPayload *)payload forType:(NSString *)type completionHandler: (void (^_Nullable)(void)) completion {
147
+ NSDictionary *streamPayload = payload.dictionaryPayload[@"stream"];
148
+ if (!streamPayload) {
149
+ #if DEBUG
150
+ NSLog(@"[StreamVideoReactNative][didReceiveIncomingPush] Stream payload not found");
151
+ #endif
152
+ if (completion) {
153
+ completion();
154
+ }
155
+ return;
156
+ }
157
+
158
+ NSString *createdCallerName = streamPayload[@"created_by_display_name"];
159
+ NSString *callCid = streamPayload[@"call_cid"];
160
+ if (!createdCallerName || !callCid) {
161
+ #if DEBUG
162
+ NSLog(@"[StreamVideoReactNative][didReceiveIncomingPush] Missing required fields: created_by_display_name or call_cid");
163
+ #endif
164
+ if (completion) {
165
+ completion();
166
+ }
167
+ return;
168
+ }
169
+
170
+ if (![StreamVideoReactNative canRegisterCall]) {
171
+ if (completion) {
172
+ completion();
173
+ }
174
+ return;
175
+ }
176
+
177
+ [StreamVideoReactNative reportNewIncomingCall:streamPayload forType:type completionHandler:completion];
178
+ [StreamVideoReactNative didReceiveIncomingPushWithPayload:payload forType:type];
179
+ }
180
+
181
+ +(void)reportNewIncomingCall:(NSDictionary *)streamPayload forType:(NSString *)type completionHandler: (void (^_Nullable)(void)) completion {
182
+ Class callingxClass = NSClassFromString(@"Callingx");
183
+ if (!callingxClass) {
184
+ NSLog(@"[StreamVideoReactNative][didReceiveIncomingPush] Callingx not available");
185
+ return;
186
+ }
187
+
188
+ SEL selector = @selector(reportNewIncomingCall:handle:handleType:hasVideo:localizedCallerName:supportsHolding:supportsDTMF:supportsGrouping:supportsUngrouping:fromPushKit:payload:withCompletionHandler:);
189
+ if (![callingxClass respondsToSelector:selector]) {
190
+ #if DEBUG
191
+ NSLog(@"[StreamVideoReactNative][didReceiveIncomingPush] Callingx does not respond to selector");
192
+ #endif
193
+ return;
194
+ }
195
+
196
+ NSString *callCid = streamPayload[@"call_cid"];
197
+ NSString *createdCallerName = streamPayload[@"created_by_display_name"];
198
+ NSString *videoIncluded = streamPayload[@"video"];
199
+ BOOL hasVideo = [videoIncluded isEqualToString:@"false"] ? NO : YES;
200
+ NSString *handleType = @"generic";
201
+ BOOL supportsHolding = NO;
202
+ BOOL supportsDTMF = NO;
203
+ BOOL supportsGrouping = NO;
204
+ BOOL supportsUngrouping = NO;
205
+ BOOL fromPushKit = YES;
206
+ void (^completionHandler)(void) = completion;
207
+
208
+ NSMethodSignature *signature = [callingxClass methodSignatureForSelector:selector];
209
+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
210
+ [invocation setTarget:callingxClass];
211
+ [invocation setSelector:selector];
212
+ [invocation setArgument:&callCid atIndex:2];
213
+ [invocation setArgument:&createdCallerName atIndex:3];
214
+ [invocation setArgument:&handleType atIndex:4];
215
+ [invocation setArgument:&hasVideo atIndex:5];
216
+ [invocation setArgument:&createdCallerName atIndex:6];
217
+ [invocation setArgument:&supportsHolding atIndex:7];
218
+ [invocation setArgument:&supportsDTMF atIndex:8];
219
+ [invocation setArgument:&supportsGrouping atIndex:9];
220
+ [invocation setArgument:&supportsUngrouping atIndex:10];
221
+ [invocation setArgument:&fromPushKit atIndex:11];
222
+ [invocation setArgument:&streamPayload atIndex:12];
223
+ [invocation setArgument:&completionHandler atIndex:13];
224
+ [invocation invoke];
225
+ }
226
+
227
+ +(void)didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type {
228
+ Class voipManagerClass = NSClassFromString(@"Callingx.VoipNotificationsManager");
229
+ if (!voipManagerClass) {
230
+ // Fallback: Try the unmangled name (might work depending on Swift version)
231
+ voipManagerClass = NSClassFromString(@"VoipNotificationsManager");
232
+ }
233
+
234
+ if (!voipManagerClass) {
235
+ #if DEBUG
236
+ NSLog(@"[StreamVideoReactNative][didReceiveIncomingPushWithPayload] VoipNotificationsManager not available");
237
+ #endif
238
+ return;
239
+ }
240
+
241
+ SEL selector = @selector(didReceiveIncomingPushWithPayload:forType:);
242
+ if (![voipManagerClass respondsToSelector:selector]) {
243
+ #if DEBUG
244
+ NSLog(@"[StreamVideoReactNative][didReceiveIncomingPushWithPayload] VoipNotificationsManager does not respond to didReceiveIncomingPushWithPayload:forType:");
245
+ #endif
246
+ return;
247
+ }
248
+
249
+ [voipManagerClass didReceiveIncomingPushWithPayload:payload forType:type];
250
+ }
251
+
68
252
  -(instancetype)init {
69
253
  if ((self = [super init])) {
70
254
  _notificationCenter = CFNotificationCenterGetDarwinNotifyCenter();
@@ -191,71 +375,6 @@ RCT_EXPORT_METHOD(currentThermalState:(RCTPromiseResolveBlock)resolve rejecter:(
191
375
  }
192
376
  }
193
377
 
194
- +(void)registerIncomingCall:(NSString *)cid uuid:(NSString *)uuid {
195
- [StreamVideoReactNative initializeSharedDictionaries];
196
- dispatch_sync(_dictionaryQueue, ^{
197
-
198
- #ifdef DEBUG
199
- NSLog(@"registerIncomingCall cid:%@ -> uuid:%@",cid,uuid);
200
- #endif
201
- NSString *lowercaseUUID = [uuid lowercaseString];
202
- _incomingCallUUIDsByCallID[cid] = lowercaseUUID;
203
- _incomingCallCidsByUUID[lowercaseUUID] = cid;
204
- });
205
- }
206
-
207
- RCT_EXPORT_METHOD(getIncomingCallUUid:(NSString *)cid
208
- resolver:(RCTPromiseResolveBlock)resolve
209
- rejecter:(RCTPromiseRejectBlock)reject)
210
- {
211
- dispatch_sync(_dictionaryQueue, ^{
212
- NSString *uuid = _incomingCallUUIDsByCallID[cid];
213
- if (uuid) {
214
- resolve(uuid);
215
- } else {
216
- NSString *errorString = [NSString stringWithFormat:@"requested incoming call not found for cid: %@", cid];
217
- reject(@"access_failure", errorString, nil);
218
- }
219
- });
220
- }
221
-
222
- RCT_EXPORT_METHOD(getIncomingCallCid:(NSString *)uuid
223
- resolver:(RCTPromiseResolveBlock)resolve
224
- rejecter:(RCTPromiseRejectBlock)reject)
225
- {
226
- dispatch_sync(_dictionaryQueue, ^{
227
- NSString *lowercaseUUID = [uuid lowercaseString];
228
- NSString *foundCid = _incomingCallCidsByUUID[lowercaseUUID];
229
-
230
- if (foundCid) {
231
- resolve(foundCid);
232
- } else {
233
- NSString *errorString = [NSString stringWithFormat:@"requested incoming call not found for uuid: %@", uuid];
234
- reject(@"access_failure", errorString, nil);
235
- }
236
- });
237
- }
238
-
239
- RCT_EXPORT_METHOD(removeIncomingCall:(NSString *)cid
240
- resolver:(RCTPromiseResolveBlock)resolve
241
- rejecter:(RCTPromiseRejectBlock)reject)
242
- {
243
- dispatch_sync(_dictionaryQueue, ^{
244
- NSString *uuid = _incomingCallUUIDsByCallID[cid];
245
- if (uuid) {
246
- #ifdef DEBUG
247
- NSLog(@"removeIncomingCall cid:%@ -> uuid:%@",cid,uuid);
248
- #endif
249
-
250
- [_incomingCallUUIDsByCallID removeObjectForKey:cid];
251
- [_incomingCallCidsByUUID removeObjectForKey:uuid];
252
- resolve(@YES);
253
- } else {
254
- resolve(@NO);
255
- }
256
- });
257
- }
258
-
259
378
  RCT_EXPORT_METHOD(captureRef:(nonnull NSNumber *)reactTag
260
379
  options:(NSDictionary *)options
261
380
  resolver:(RCTPromiseResolveBlock)resolve
@@ -373,17 +492,7 @@ RCT_EXPORT_METHOD(getBatteryState:(RCTPromiseResolveBlock)resolve
373
492
  ];
374
493
  }
375
494
 
376
- +(BOOL)shouldRejectCallWhenBusy {
377
- return _shouldRejectCallWhenBusy;
378
- }
379
-
380
- RCT_EXPORT_METHOD(setShouldRejectCallWhenBusy:(BOOL)shouldReject) {
381
- _shouldRejectCallWhenBusy = shouldReject;
382
- #ifdef DEBUG
383
- NSLog(@"setShouldRejectCallWhenBusy: %@", shouldReject ? @"YES" : @"NO");
384
- #endif
385
- }
386
-
495
+ //current implementation will return any registered calls not only stream calls
387
496
  + (BOOL)hasAnyActiveCall
388
497
  {
389
498
  CXCallObserver *callObserver = [[CXCallObserver alloc] init];