Skip to content

Commit 6976acd

Browse files
committed
Mute connection method added
1 parent 192912c commit 6976acd

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ let Twilio = {
3232
ignore() {
3333
TwilioRCT.ignore();
3434
},
35+
setMuted(isMuted) {
36+
TwilioRCT.setMuted(isMuted);
37+
},
3538
addEventListener(type, handler) {
3639
_eventHandlers[type].set(handler, NativeAppEventEmitter.addListener(
3740
type, rtn => {

ios/RCTTwilio/RCTTwilio.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ @implementation RCTTwilio {
5252
[_pendingConnection ignore];
5353
}
5454

55+
RCT_EXPORT_METHOD(setMuted:(BOOL)isMuted) {
56+
if (_connection && _connection.state == TCConnectionStateConnected) {
57+
[_connection setMuted:isMuted];
58+
}
59+
}
60+
5561
#pragma mark - TCDeviceDelegate
5662

5763
-(void)device:(TCDevice *)device didReceiveIncomingConnection:(TCConnection *)connection {
@@ -65,8 +71,12 @@ -(void)deviceDidStartListeningForIncomingConnections:(TCDevice*)device {
6571
}
6672

6773
-(void)device:(TCDevice *)device didStopListeningForIncomingConnections:(NSError *)error {
74+
id body = nil;
75+
if (error != nil) {
76+
body = @{@"err": [error localizedDescription]};
77+
}
6878
[self.bridge.eventDispatcher
69-
sendAppEventWithName:@"deviceDidStopListening" body:@{@"err": [error localizedDescription]}];
79+
sendAppEventWithName:@"deviceDidStopListening" body:body];
7080
}
7181

7282
#pragma mark - TCConnectionDelegate

0 commit comments

Comments
 (0)