voice-react-native-sdk 2.0.0-preview.fork.3 → 2.0.0-preview.fork.4

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.
@@ -6,6 +6,7 @@
6
6
  //
7
7
 
8
8
  @import AVKit;
9
+ @import CallKit;
9
10
 
10
11
  #import "TwilioVoicePushRegistry.h"
11
12
  #import "TwilioVoiceReactNative.h"
@@ -780,9 +781,21 @@ RCT_EXPORT_METHOD(call_hold:(NSString *)uuid
780
781
  {
781
782
  TVOCall *call = [self getCallFromMap:uuid resolver:resolver];
782
783
  if (!call) return;
783
-
784
- [call setOnHold:onHold];
785
- [self resolvePromise:resolver value:@(call.isOnHold)];
784
+
785
+ // Persist the hold state to CallKit
786
+ // This is to fix a bug where when ending a call, if there was another call on hold, the call would not allow voice input/output.
787
+ CXSetHeldCallAction *holdAction = [[CXSetHeldCallAction alloc] initWithCallUUID:call.uuid onHold:onHold];
788
+ CXTransaction *transaction = [[CXTransaction alloc] initWithAction:holdAction];
789
+
790
+ [self.callKitCallController requestTransaction:transaction completion:^(NSError *error) {
791
+ if (error) {
792
+ [call setOnHold:onHold];
793
+ if (!onHold) {
794
+ [TwilioVoiceReactNative twilioAudioDevice].enabled = YES;
795
+ }
796
+ }
797
+ [self resolvePromise:resolver value:@(call.isOnHold)];
798
+ }];
786
799
  }
787
800
 
788
801
  RCT_EXPORT_METHOD(call_isOnHold:(NSString *)uuid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voice-react-native-sdk",
3
- "version": "2.0.0-preview.fork.3",
3
+ "version": "2.0.0-preview.fork.4",
4
4
  "description": "Twilio Voice React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",