Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

Save last uuid to fix issue with EndCall Transaction #42

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ios/RNCallKit/RNCallKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ @implementation RNCallKit
NSMutableDictionary *_settings;
NSOperatingSystemVersion _version;
BOOL _isStartCallActionEventListenerAdded;
NSUUID *_lastUUID;
}

// should initialise in AppDelegate.m
Expand Down Expand Up @@ -107,6 +108,7 @@ - (void)dealloc
#endif
int _handleType = [self getHandleType:handleType];
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
_lastUUID = uuid;
CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init];
callUpdate.remoteHandle = [[CXHandle alloc] initWithType:_handleType value:handle];
callUpdate.supportsDTMF = YES;
Expand Down Expand Up @@ -194,6 +196,7 @@ - (void)dealloc
RCT_EXPORT_METHOD(reportConnectedOutgoingCallWithUUID:(NSString *)uuidString)
{
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:uuidString];
_lastUUID = uuid;
[self.callKitProvider reportOutgoingCallWithUUID:uuid connectedAtDate:[NSDate date]];
}

Expand Down Expand Up @@ -288,6 +291,11 @@ - (CXProviderConfiguration *)getProviderConfiguration
if (_settings[@"ringtoneSound"]) {
providerConfiguration.ringtoneSound = _settings[@"ringtoneSound"];
}
if (@available(iOS 11.0, *)) {
if (_settings[@"includesInRecents"]) {
providerConfiguration.includesCallsInRecents = [_settings[@"includesInRecents"] boolValue];
}
}
return providerConfiguration;
}

Expand All @@ -300,7 +308,7 @@ - (void)configureAudioSession
AVAudioSession* audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];

[audioSession setMode:AVAudioSessionModeVoiceChat error:nil];
[audioSession setMode:AVAudioSessionModeVideoChat error:nil];

double sampleRate = 44100.0;
[audioSession setPreferredSampleRate:sampleRate error:nil];
Expand Down Expand Up @@ -440,6 +448,7 @@ - (void)provider:(CXProvider *)provider performSetHeldCallAction:(CXSetHeldCallA
#ifdef DEBUG
NSLog(@"[RNCallKit][CXProviderDelegate][provider:performSetHeldCallAction]");
#endif
[action fulfill];
}

- (void)provider:(CXProvider *)provider timedOutPerformingAction:(CXAction *)action
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-callkit",
"version": "1.3.3",
"version": "1.3.4",
"description": "iOS 10 CallKit Framework For React Native",
"main": "index.js",
"scripts": {
Expand Down