rn: add a new advanced settings section
Currently only 2 options are implemented, mainly aimed at helping troubleshoot audio related problems: - Disable native call integration (it disables CallKit / ConnectionService) - Disable P2P
This commit is contained in:
committed by
Saúl Ibarra Corretgé
parent
fe90e5aa8f
commit
6d16e087d9
20
react/features/mobile/call-integration/functions.js
Normal file
20
react/features/mobile/call-integration/functions.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// @flow
|
||||
|
||||
import { CALL_INTEGRATION_ENABLED, getFeatureFlag } from '../../base/flags';
|
||||
import { toState } from '../../base/redux';
|
||||
|
||||
/**
|
||||
* Checks if call integration is enabled or not.
|
||||
*
|
||||
* @param {Function|Object} stateful - The redux store or {@code getState}
|
||||
* function.
|
||||
* @returns {string} - Default URL for the app.
|
||||
*/
|
||||
export function isCallIntegrationEnabled(stateful: Function | Object) {
|
||||
const state = toState(stateful);
|
||||
const { disableCallIntegration } = state['features/base/settings'];
|
||||
const flag = getFeatureFlag(state, CALL_INTEGRATION_ENABLED);
|
||||
|
||||
// The feature flag has precedence.
|
||||
return flag ?? !disableCallIntegration;
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import { _SET_CALL_INTEGRATION_SUBSCRIPTIONS } from './actionTypes';
|
||||
|
||||
import CallKit from './CallKit';
|
||||
import ConnectionService from './ConnectionService';
|
||||
import { isCallIntegrationEnabled } from './functions';
|
||||
|
||||
const CallIntegration = CallKit || ConnectionService;
|
||||
|
||||
@@ -139,9 +140,13 @@ function _appWillMount({ dispatch, getState }, next, action) {
|
||||
* @private
|
||||
* @returns {*} The value returned by {@code next(action)}.
|
||||
*/
|
||||
function _conferenceFailed(store, next, action) {
|
||||
function _conferenceFailed({ getState }, next, action) {
|
||||
const result = next(action);
|
||||
|
||||
if (!isCallIntegrationEnabled(getState)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// XXX Certain CONFERENCE_FAILED errors are recoverable i.e. they have
|
||||
// prevented the user from joining a specific conference but the app may be
|
||||
// able to eventually join the conference.
|
||||
@@ -173,6 +178,10 @@ function _conferenceFailed(store, next, action) {
|
||||
function _conferenceJoined({ getState }, next, action) {
|
||||
const result = next(action);
|
||||
|
||||
if (!isCallIntegrationEnabled(getState)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const { callUUID } = action.conference;
|
||||
|
||||
if (callUUID) {
|
||||
@@ -201,9 +210,13 @@ function _conferenceJoined({ getState }, next, action) {
|
||||
* @private
|
||||
* @returns {*} The value returned by {@code next(action)}.
|
||||
*/
|
||||
function _conferenceLeft(store, next, action) {
|
||||
function _conferenceLeft({ getState }, next, action) {
|
||||
const result = next(action);
|
||||
|
||||
if (!isCallIntegrationEnabled(getState)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const { callUUID } = action.conference;
|
||||
|
||||
if (callUUID) {
|
||||
@@ -230,6 +243,10 @@ function _conferenceLeft(store, next, action) {
|
||||
function _conferenceWillJoin({ dispatch, getState }, next, action) {
|
||||
const result = next(action);
|
||||
|
||||
if (!isCallIntegrationEnabled(getState)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const { conference } = action;
|
||||
const state = getState();
|
||||
const { callHandle, callUUID } = state['features/base/config'];
|
||||
@@ -341,6 +358,11 @@ function _onPerformSetMutedCallAction({ callUUID, muted }) {
|
||||
function _setAudioOnly({ getState }, next, action) {
|
||||
const result = next(action);
|
||||
const state = getState();
|
||||
|
||||
if (!isCallIntegrationEnabled(state)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const conference = getCurrentConference(state);
|
||||
|
||||
if (conference && conference.callUUID) {
|
||||
@@ -393,6 +415,11 @@ function _setCallKitSubscriptions({ getState }, next, action) {
|
||||
*/
|
||||
function _syncTrackState({ getState }, next, action) {
|
||||
const result = next(action);
|
||||
|
||||
if (!isCallIntegrationEnabled(getState)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const { jitsiTrack } = action.track;
|
||||
const state = getState();
|
||||
const conference = getCurrentConference(state);
|
||||
|
||||
Reference in New Issue
Block a user