Skip to content
This repository was archived by the owner on May 26, 2019. It is now read-only.
Merged
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ Call when you finish an incoming/outgoing call

Switch the mic on/off

### checkIfBusy

Checks if there are any active calls on the device and returns a promise with a boolean value (`true` if there're active calls, `false` otherwise).

## Events

### - didReceiveStartCallAction
Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ export default class RNCallKit {
_RNCallKit.setMutedCall(uuid, muted);
}

static checkIfBusy() {
return Platform.OS === 'ios'
? _RNCallKit.checkIfBusy()
: Promise.reject('RNCallKit.checkIfBusy was called from unsupported OS');
};

/*
static setHeldCall(uuid, onHold) {
if (Platform.OS !== 'ios') return;
Expand Down
10 changes: 10 additions & 0 deletions ios/RNCallKit/RNCallKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ - (void)dealloc
[self.callKitProvider setDelegate:self queue:nil];
}

RCT_REMAP_METHOD(checkIfBusy,
checkIfBusyWithResolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
#ifdef DEBUG
NSLog(@"[RNCallKit][checkIfBusy]");
#endif
resolve(@(self.callKitCallController.callObserver.calls.count > 0));
}

#pragma mark - CXCallController call actions

// Display the incoming call to the user
Expand Down