fix(ios) use the RN logger in RN modules
The eventual RN SDK doesn't need to depend on our logger. When the native SDK i used the RN logger is diverted to ours anyway.
This commit is contained in:
parent
3a87282e26
commit
91cbeb0b3f
|
@ -21,7 +21,6 @@
|
||||||
#import <WebRTC/WebRTC.h>
|
#import <WebRTC/WebRTC.h>
|
||||||
|
|
||||||
#import "JitsiAudioSession+Private.h"
|
#import "JitsiAudioSession+Private.h"
|
||||||
#import "LogUtils.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Audio mode
|
// Audio mode
|
||||||
|
@ -178,7 +177,7 @@ RCT_EXPORT_METHOD(setMode:(int)mode
|
||||||
RCT_EXPORT_METHOD(setAudioDevice:(NSString *)device
|
RCT_EXPORT_METHOD(setAudioDevice:(NSString *)device
|
||||||
resolve:(RCTPromiseResolveBlock)resolve
|
resolve:(RCTPromiseResolveBlock)resolve
|
||||||
reject:(RCTPromiseRejectBlock)reject) {
|
reject:(RCTPromiseRejectBlock)reject) {
|
||||||
DDLogInfo(@"[AudioMode] Selected device: %@", device);
|
RCTLogInfo(@"[AudioMode] Selected device: %@", device);
|
||||||
|
|
||||||
RTCAudioSession *session = JitsiAudioSession.rtcAudioSession;
|
RTCAudioSession *session = JitsiAudioSession.rtcAudioSession;
|
||||||
[session lockForConfiguration];
|
[session lockForConfiguration];
|
||||||
|
@ -248,7 +247,7 @@ RCT_EXPORT_METHOD(updateDeviceList) {
|
||||||
- (void)audioSessionDidChangeRoute:(RTCAudioSession *)session
|
- (void)audioSessionDidChangeRoute:(RTCAudioSession *)session
|
||||||
reason:(AVAudioSessionRouteChangeReason)reason
|
reason:(AVAudioSessionRouteChangeReason)reason
|
||||||
previousRoute:(AVAudioSessionRouteDescription *)previousRoute {
|
previousRoute:(AVAudioSessionRouteDescription *)previousRoute {
|
||||||
DDLogInfo(@"[AudioMode] Route changed, reason: %lu", (unsigned long)reason);
|
RCTLogInfo(@"[AudioMode] Route changed, reason: %lu", (unsigned long)reason);
|
||||||
|
|
||||||
// Update JS about the changes.
|
// Update JS about the changes.
|
||||||
[self notifyDevicesChanged];
|
[self notifyDevicesChanged];
|
||||||
|
@ -275,7 +274,7 @@ RCT_EXPORT_METHOD(updateDeviceList) {
|
||||||
// This is to play well with other components which could be integrated
|
// This is to play well with other components which could be integrated
|
||||||
// into the final application.
|
// into the final application.
|
||||||
if (self->activeMode != kAudioModeDefault) {
|
if (self->activeMode != kAudioModeDefault) {
|
||||||
DDLogInfo(@"[AudioMode] Route changed, reapplying RTCAudioSession config");
|
RCTLogInfo(@"[AudioMode] Route changed, reapplying RTCAudioSession config");
|
||||||
RTCAudioSessionConfiguration *config = [self configForMode:self->activeMode];
|
RTCAudioSessionConfiguration *config = [self configForMode:self->activeMode];
|
||||||
[self setConfig:config error:nil];
|
[self setConfig:config error:nil];
|
||||||
if (self->forceSpeaker && !self->isSpeakerOn) {
|
if (self->forceSpeaker && !self->isSpeakerOn) {
|
||||||
|
@ -288,7 +287,7 @@ RCT_EXPORT_METHOD(updateDeviceList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)audioSession:(RTCAudioSession *)audioSession didSetActive:(BOOL)active {
|
- (void)audioSession:(RTCAudioSession *)audioSession didSetActive:(BOOL)active {
|
||||||
DDLogInfo(@"[AudioMode] Audio session didSetActive:%d", active);
|
RCTLogInfo(@"[AudioMode] Audio session didSetActive:%d", active);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Helper methods
|
#pragma mark - Helper methods
|
||||||
|
|
|
@ -26,11 +26,10 @@
|
||||||
#import <React/RCTBridge.h>
|
#import <React/RCTBridge.h>
|
||||||
#import <React/RCTEventEmitter.h>
|
#import <React/RCTEventEmitter.h>
|
||||||
#import <React/RCTUtils.h>
|
#import <React/RCTUtils.h>
|
||||||
|
#import <React/RCTLog.h>
|
||||||
#import <WebRTC/WebRTC.h>
|
#import <WebRTC/WebRTC.h>
|
||||||
|
|
||||||
#import <JitsiMeetSDK/JitsiMeetSDK-Swift.h>
|
#import <JitsiMeetSDK/JitsiMeetSDK-Swift.h>
|
||||||
|
|
||||||
#import "../LogUtils.h"
|
|
||||||
#import "JitsiAudioSession.h"
|
#import "JitsiAudioSession.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ RCT_EXPORT_MODULE();
|
||||||
RCT_EXPORT_METHOD(endCall:(NSString *)callUUID
|
RCT_EXPORT_METHOD(endCall:(NSString *)callUUID
|
||||||
resolve:(RCTPromiseResolveBlock)resolve
|
resolve:(RCTPromiseResolveBlock)resolve
|
||||||
reject:(RCTPromiseRejectBlock)reject) {
|
reject:(RCTPromiseRejectBlock)reject) {
|
||||||
DDLogInfo(@"[RNCallKit][endCall] callUUID = %@", callUUID);
|
RCTLogInfo(@"[RNCallKit][endCall] callUUID = %@", callUUID);
|
||||||
|
|
||||||
NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
|
NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ RCT_EXPORT_METHOD(setMuted:(NSString *)callUUID
|
||||||
muted:(BOOL)muted
|
muted:(BOOL)muted
|
||||||
resolve:(RCTPromiseResolveBlock)resolve
|
resolve:(RCTPromiseResolveBlock)resolve
|
||||||
reject:(RCTPromiseRejectBlock)reject) {
|
reject:(RCTPromiseRejectBlock)reject) {
|
||||||
DDLogInfo(@"[RNCallKit][setMuted] callUUID = %@", callUUID);
|
RCTLogInfo(@"[RNCallKit][setMuted] callUUID = %@", callUUID);
|
||||||
|
|
||||||
NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
|
NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
|
||||||
|
|
||||||
|
@ -111,7 +110,7 @@ RCT_EXPORT_METHOD(setMuted:(NSString *)callUUID
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(setProviderConfiguration:(NSDictionary *)dictionary) {
|
RCT_EXPORT_METHOD(setProviderConfiguration:(NSDictionary *)dictionary) {
|
||||||
DDLogInfo(@"[RNCallKit][setProviderConfiguration:] dictionary = %@", dictionary);
|
RCTLogInfo(@"[RNCallKit][setProviderConfiguration:] dictionary = %@", dictionary);
|
||||||
|
|
||||||
if (![JMCallKitProxy isProviderConfigured]) {
|
if (![JMCallKitProxy isProviderConfigured]) {
|
||||||
JMCallKitProxy.enabled = true;
|
JMCallKitProxy.enabled = true;
|
||||||
|
@ -128,7 +127,7 @@ RCT_EXPORT_METHOD(startCall:(NSString *)callUUID
|
||||||
video:(BOOL)video
|
video:(BOOL)video
|
||||||
resolve:(RCTPromiseResolveBlock)resolve
|
resolve:(RCTPromiseResolveBlock)resolve
|
||||||
reject:(RCTPromiseRejectBlock)reject) {
|
reject:(RCTPromiseRejectBlock)reject) {
|
||||||
DDLogInfo(@"[RNCallKit][startCall] callUUID = %@", callUUID);
|
RCTLogInfo(@"[RNCallKit][startCall] callUUID = %@", callUUID);
|
||||||
|
|
||||||
NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
|
NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
|
||||||
|
|
||||||
|
@ -192,7 +191,7 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
|
||||||
options:(NSDictionary *)options
|
options:(NSDictionary *)options
|
||||||
resolve:(RCTPromiseResolveBlock)resolve
|
resolve:(RCTPromiseResolveBlock)resolve
|
||||||
reject:(RCTPromiseRejectBlock)reject) {
|
reject:(RCTPromiseRejectBlock)reject) {
|
||||||
DDLogInfo(@"[RNCallKit][updateCall] callUUID = %@ options = %@", callUUID, options);
|
RCTLogInfo(@"[RNCallKit][updateCall] callUUID = %@ options = %@", callUUID, options);
|
||||||
|
|
||||||
NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
|
NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
|
||||||
|
|
||||||
|
@ -215,7 +214,7 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
|
||||||
#pragma mark - Helper methods
|
#pragma mark - Helper methods
|
||||||
|
|
||||||
- (void)configureProviderFromDictionary:(NSDictionary* )dictionary {
|
- (void)configureProviderFromDictionary:(NSDictionary* )dictionary {
|
||||||
DDLogInfo(@"[RNCallKit][providerConfigurationFromDictionary: %@]", dictionary);
|
RCTLogInfo(@"[RNCallKit][providerConfigurationFromDictionary: %@]", dictionary);
|
||||||
|
|
||||||
if (!dictionary) {
|
if (!dictionary) {
|
||||||
dictionary = @{};
|
dictionary = @{};
|
||||||
|
@ -259,12 +258,12 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
|
||||||
- (void)requestTransaction:(CXTransaction *)transaction
|
- (void)requestTransaction:(CXTransaction *)transaction
|
||||||
resolve:(RCTPromiseResolveBlock)resolve
|
resolve:(RCTPromiseResolveBlock)resolve
|
||||||
reject:(RCTPromiseRejectBlock)reject {
|
reject:(RCTPromiseRejectBlock)reject {
|
||||||
DDLogInfo(@"[RNCallKit][requestTransaction] transaction = %@", transaction);
|
RCTLogInfo(@"[RNCallKit][requestTransaction] transaction = %@", transaction);
|
||||||
|
|
||||||
[JMCallKitProxy request:transaction
|
[JMCallKitProxy request:transaction
|
||||||
completion:^(NSError * _Nullable error) {
|
completion:^(NSError * _Nullable error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
DDLogError(@"[RNCallKit][requestTransaction] Error requesting transaction (%@): (%@)", transaction.actions, error);
|
RCTLogError(@"[RNCallKit][requestTransaction] Error requesting transaction (%@): (%@)", transaction.actions, error);
|
||||||
reject(nil, @"Error processing CallKit transaction", error);
|
reject(nil, @"Error processing CallKit transaction", error);
|
||||||
} else {
|
} else {
|
||||||
resolve(nil);
|
resolve(nil);
|
||||||
|
@ -276,14 +275,14 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
|
||||||
|
|
||||||
// Called when the provider has been reset. We should terminate all calls.
|
// Called when the provider has been reset. We should terminate all calls.
|
||||||
- (void)providerDidReset {
|
- (void)providerDidReset {
|
||||||
DDLogInfo(@"[RNCallKit][CXProviderDelegate][providerDidReset:]");
|
RCTLogInfo(@"[RNCallKit][CXProviderDelegate][providerDidReset:]");
|
||||||
|
|
||||||
[self sendEventWithName:RNCallKitProviderDidReset body:nil];
|
[self sendEventWithName:RNCallKitProviderDidReset body:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Answering incoming call
|
// Answering incoming call
|
||||||
- (void) performAnswerCallWithUUID:(NSUUID *)UUID {
|
- (void) performAnswerCallWithUUID:(NSUUID *)UUID {
|
||||||
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performAnswerCallAction:]");
|
RCTLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performAnswerCallAction:]");
|
||||||
|
|
||||||
[self sendEventWithName:RNCallKitPerformAnswerCallAction
|
[self sendEventWithName:RNCallKitPerformAnswerCallAction
|
||||||
body:@{ @"callUUID": UUID.UUIDString }];
|
body:@{ @"callUUID": UUID.UUIDString }];
|
||||||
|
@ -291,7 +290,7 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
|
||||||
|
|
||||||
// Call ended, user request
|
// Call ended, user request
|
||||||
- (void) performEndCallWithUUID:(NSUUID *)UUID {
|
- (void) performEndCallWithUUID:(NSUUID *)UUID {
|
||||||
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performEndCallAction:]");
|
RCTLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performEndCallAction:]");
|
||||||
|
|
||||||
[self sendEventWithName:RNCallKitPerformEndCallAction
|
[self sendEventWithName:RNCallKitPerformEndCallAction
|
||||||
body:@{ @"callUUID": UUID.UUIDString }];
|
body:@{ @"callUUID": UUID.UUIDString }];
|
||||||
|
@ -300,7 +299,7 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
|
||||||
// Handle audio mute from CallKit view
|
// Handle audio mute from CallKit view
|
||||||
- (void) performSetMutedCallWithUUID:(NSUUID *)UUID
|
- (void) performSetMutedCallWithUUID:(NSUUID *)UUID
|
||||||
isMuted:(BOOL)isMuted {
|
isMuted:(BOOL)isMuted {
|
||||||
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performSetMutedCallAction:]");
|
RCTLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performSetMutedCallAction:]");
|
||||||
|
|
||||||
[self sendEventWithName:RNCallKitPerformSetMutedCallAction
|
[self sendEventWithName:RNCallKitPerformSetMutedCallAction
|
||||||
body:@{
|
body:@{
|
||||||
|
@ -312,26 +311,26 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
|
||||||
// Starting outgoing call
|
// Starting outgoing call
|
||||||
- (void) performStartCallWithUUID:(NSUUID *)UUID
|
- (void) performStartCallWithUUID:(NSUUID *)UUID
|
||||||
isVideo:(BOOL)isVideo {
|
isVideo:(BOOL)isVideo {
|
||||||
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performStartCallAction:]");
|
RCTLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performStartCallAction:]");
|
||||||
|
|
||||||
[JMCallKitProxy reportOutgoingCallWith:UUID
|
[JMCallKitProxy reportOutgoingCallWith:UUID
|
||||||
startedConnectingAt:nil];
|
startedConnectingAt:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) providerDidActivateAudioSessionWithSession:(AVAudioSession *)session {
|
- (void) providerDidActivateAudioSessionWithSession:(AVAudioSession *)session {
|
||||||
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didActivateAudioSession:]");
|
RCTLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didActivateAudioSession:]");
|
||||||
|
|
||||||
[JitsiAudioSession activateWithAudioSession:session];
|
[JitsiAudioSession activateWithAudioSession:session];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) providerDidDeactivateAudioSessionWithSession:(AVAudioSession *)session {
|
- (void) providerDidDeactivateAudioSessionWithSession:(AVAudioSession *)session {
|
||||||
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didDeactivateAudioSession:]");
|
RCTLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didDeactivateAudioSession:]");
|
||||||
|
|
||||||
[JitsiAudioSession deactivateWithAudioSession:session];
|
[JitsiAudioSession deactivateWithAudioSession:session];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) providerTimedOutPerformingActionWithAction:(CXAction *)action {
|
- (void) providerTimedOutPerformingActionWithAction:(CXAction *)action {
|
||||||
DDLogWarn(@"[RNCallKit][CXProviderDelegate][provider:timedOutPerformingAction:]");
|
RCTLogWarn(@"[RNCallKit][CXProviderDelegate][provider:timedOutPerformingAction:]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue