Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): The getAudioRoutes changes the selected audio route #557

Open
wants to merge 15 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
5 changes: 5 additions & 0 deletions actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const RNCallKeepDidDeactivateAudioSession = 'RNCallKeepDidDeactivateAudioSession
const RNCallKeepDidDisplayIncomingCall = 'RNCallKeepDidDisplayIncomingCall';
const RNCallKeepDidPerformSetMutedCallAction = 'RNCallKeepDidPerformSetMutedCallAction';
const RNCallKeepDidToggleHoldAction = 'RNCallKeepDidToggleHoldAction';
const RNCallKeepPerformGroupCallAction = 'RNCallKeepPerformGroupCallAction';
const RNCallKeepDidPerformDTMFAction = 'RNCallKeepDidPerformDTMFAction';
const RNCallKeepProviderReset = 'RNCallKeepProviderReset';
const RNCallKeepCheckReachability = 'RNCallKeepCheckReachability';
Expand Down Expand Up @@ -63,6 +64,9 @@ const didPerformSetMutedCallAction = handler =>
const didToggleHoldCallAction = handler =>
eventEmitter.addListener(RNCallKeepDidToggleHoldAction, handler);

const performGroupCallAction = handler =>
eventEmitter.addListener(RNCallKeepPerformGroupCallAction, handler);

const didPerformDTMFAction = handler =>
eventEmitter.addListener(RNCallKeepDidPerformDTMFAction, (data) => handler(data));

Expand Down Expand Up @@ -95,6 +99,7 @@ export const listeners = {
didDisplayIncomingCall,
didPerformSetMutedCallAction,
didToggleHoldCallAction,
performGroupCallAction,
didPerformDTMFAction,
didResetProvider,
checkReachability,
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ repositories {
}

dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'com.facebook.react:react-native:0.66.3'
}
8 changes: 8 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare module 'react-native-callkeep' {
'didDeactivateAudioSession' |
'didDisplayIncomingCall' |
'didToggleHoldCallAction' |
'performGroupCallAction' |
'didPerformDTMFAction' |
'didResetProvider' |
'checkReachability' |
Expand Down Expand Up @@ -175,6 +176,9 @@ declare module 'react-native-callkeep' {
static toggleAudioRouteSpeaker(uuid: string, routeSpeaker: boolean): void

static setOnHold(uuid: string, held: boolean): void

static setGroupCall(activeUuid: string, heldUuid: string): void
static setGroupCallFulfilled(): void

static setConnectionState(uuid: string, state: number): void

Expand All @@ -199,5 +203,9 @@ declare module 'react-native-callkeep' {
static setCurrentCallActive(callUUID: string): void

static backToForeground(): void

static configureVoiceAudioSession(): void

static configureVideoAudioSession(): void
}
}
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ class RNCallKeep {
};

setOnHold = (uuid, shouldHold) => RNCallKeepModule.setOnHold(uuid, shouldHold);

setGroupCall = (activeUuid, heldUuid) => RNCallKeepModule.setGroupCall(activeUuid, heldUuid);
setGroupCallFulfilled = () => RNCallKeepModule.setGroupCallFulfilled();

setConnectionState = (uuid, state) => isIOS ? null : RNCallKeepModule.setConnectionState(uuid, state);

Expand Down Expand Up @@ -347,6 +350,14 @@ class RNCallKeep {
clearInitialEvents() {
return RNCallKeepModule.clearInitialEvents();
}

configureVideoAudioSession() {
return RNCallKeepModule.configureVideoAudioSession();
}

configureVoiceAudioSession() {
return RNCallKeepModule.configureVoiceAudioSession();
}
}

export default new RNCallKeep();
7 changes: 7 additions & 0 deletions ios/RNCallKeep/RNCallKeep.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@

@interface RNCallKeep : RCTEventEmitter <CXProviderDelegate>

@property(nonatomic,retain) NSTimer *forceBluetoothTimer;
@property BOOL shouldForceBluetooth;

@property (nonatomic, strong) CXCallController *callKeepCallController;
@property (nonatomic, strong) CXProvider *callKeepProvider;
@property (nonatomic, strong) CXSetGroupCallAction * callKeepGroupCallAction;

+ (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
Expand Down Expand Up @@ -47,4 +51,7 @@ continueUserActivity:(NSUserActivity *)userActivity

+ (void)setup:(NSDictionary *)options;

+ (void)configureVoiceAudioSession;
+ (void)configureVideoAudioSession;

@end
Loading