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

Commit c867951

Browse files
authored
Merge pull request #35 from aarkalyk/end-all-calls-added
Method for ending all calls
2 parents 9c9f128 + 4478a83 commit c867951

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ export default class RNCallKit {
8686
_RNCallKit.endCall(uuid);
8787
}
8888

89+
static endAllCalls() {
90+
if (Platform.OS !== 'ios') return;
91+
_RNCallKit.endAllCalls();
92+
}
93+
8994
/*
9095
static setHeldCall(uuid, onHold) {
9196
if (Platform.OS !== 'ios') return;

ios/RNCallKit/RNCallKit.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ - (void)dealloc
144144
[self requestTransaction:transaction];
145145
}
146146

147+
RCT_EXPORT_METHOD(endAllCalls)
148+
{
149+
#ifdef DEBUG
150+
NSLog(@"[RNCallKit][endAllCalls] calls = %@", self.callKitCallController.callObserver.calls);
151+
#endif
152+
for (CXCall *call in self.callKitCallController.callObserver.calls) {
153+
CXEndCallAction *endCallAction = [[CXEndCallAction alloc] initWithCallUUID:call.UUID];
154+
CXTransaction *transaction = [[CXTransaction alloc] initWithAction:endCallAction];
155+
[self requestTransaction:transaction];
156+
}
157+
}
158+
147159
RCT_EXPORT_METHOD(setHeldCall:(NSString *)uuidString onHold:(BOOL)onHold)
148160
{
149161
#ifdef DEBUG

0 commit comments

Comments
 (0)