Merge pull request #5217 from matrix-org/t3chguy/fix/15175

UI Feature Flag: Disable VoIP
This commit is contained in:
Michael Telatynski 2020-09-17 12:09:09 +01:00 committed by GitHub
commit 148a57c58e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 15 deletions

View file

@ -79,6 +79,7 @@ import { SettingLevel } from "../../settings/SettingLevel";
import { leaveRoomBehaviour } from "../../utils/membership"; import { leaveRoomBehaviour } from "../../utils/membership";
import CreateCommunityPrototypeDialog from "../views/dialogs/CreateCommunityPrototypeDialog"; import CreateCommunityPrototypeDialog from "../views/dialogs/CreateCommunityPrototypeDialog";
import ThreepidInviteStore, { IThreepidInvite, IThreepidInviteWireFormat } from "../../stores/ThreepidInviteStore"; import ThreepidInviteStore, { IThreepidInvite, IThreepidInviteWireFormat } from "../../stores/ThreepidInviteStore";
import {UIFeature} from "../../settings/UIFeature";
/** constants for MatrixChat.state.view */ /** constants for MatrixChat.state.view */
export enum Views { export enum Views {
@ -1372,15 +1373,19 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
ready: true, ready: true,
}); });
}); });
cli.on('Call.incoming', function(call) {
// we dispatch this synchronously to make sure that the event if (SettingsStore.getValue(UIFeature.Voip)) {
// handlers on the call are set up immediately (so that if cli.on('Call.incoming', function(call) {
// we get an immediate hangup, we don't get a stuck call) // we dispatch this synchronously to make sure that the event
dis.dispatch({ // handlers on the call are set up immediately (so that if
action: 'incoming_call', // we get an immediate hangup, we don't get a stuck call)
call: call, dis.dispatch({
}, true); action: 'incoming_call',
}); call: call,
}, true);
});
}
cli.on('Session.logged_out', function(errObj) { cli.on('Session.logged_out', function(errObj) {
if (Lifecycle.isLoggingOut()) return; if (Lifecycle.isLoggingOut()) return;

View file

@ -32,6 +32,7 @@ import FlairUserSettingsTab from "../settings/tabs/user/FlairUserSettingsTab";
import * as sdk from "../../../index"; import * as sdk from "../../../index";
import SdkConfig from "../../../SdkConfig"; import SdkConfig from "../../../SdkConfig";
import MjolnirUserSettingsTab from "../settings/tabs/user/MjolnirUserSettingsTab"; import MjolnirUserSettingsTab from "../settings/tabs/user/MjolnirUserSettingsTab";
import {UIFeature} from "../../../settings/UIFeature";
export const USER_GENERAL_TAB = "USER_GENERAL_TAB"; export const USER_GENERAL_TAB = "USER_GENERAL_TAB";
export const USER_APPEARANCE_TAB = "USER_APPEARANCE_TAB"; export const USER_APPEARANCE_TAB = "USER_APPEARANCE_TAB";
@ -104,12 +105,16 @@ export default class UserSettingsDialog extends React.Component {
"mx_UserSettingsDialog_preferencesIcon", "mx_UserSettingsDialog_preferencesIcon",
<PreferencesUserSettingsTab />, <PreferencesUserSettingsTab />,
)); ));
tabs.push(new Tab(
USER_VOICE_TAB, if (SettingsStore.getValue(UIFeature.Voip)) {
_td("Voice & Video"), tabs.push(new Tab(
"mx_UserSettingsDialog_voiceIcon", USER_VOICE_TAB,
<VoiceUserSettingsTab />, _td("Voice & Video"),
)); "mx_UserSettingsDialog_voiceIcon",
<VoiceUserSettingsTab />,
));
}
tabs.push(new Tab( tabs.push(new Tab(
USER_SECURITY_TAB, USER_SECURITY_TAB,
_td("Security & Privacy"), _td("Security & Privacy"),

View file

@ -588,6 +588,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
"showCallButtonsInComposer": { "showCallButtonsInComposer": {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
default: true, default: true,
controller: new UIFeatureController(UIFeature.Voip),
}, },
"e2ee.manuallyVerifyAllSessions": { "e2ee.manuallyVerifyAllSessions": {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
@ -622,6 +623,10 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_UI_FEATURE, supportedLevels: LEVELS_UI_FEATURE,
default: true, default: true,
}, },
[UIFeature.Voip]: {
supportedLevels: LEVELS_UI_FEATURE,
default: true,
},
[UIFeature.Feedback]: { [UIFeature.Feedback]: {
supportedLevels: LEVELS_UI_FEATURE, supportedLevels: LEVELS_UI_FEATURE,
default: true, default: true,

View file

@ -18,5 +18,6 @@ limitations under the License.
export enum UIFeature { export enum UIFeature {
URLPreviews = "UIFeature.urlPreviews", URLPreviews = "UIFeature.urlPreviews",
Widgets = "UIFeature.widgets", Widgets = "UIFeature.widgets",
Voip = "UIFeature.voip",
Feedback = "UIFeature.feedback", Feedback = "UIFeature.feedback",
} }