From 41576954fd3dfbdff9604a76760e10db44c8f5b4 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 8 Mar 2021 20:20:07 -0700 Subject: [PATCH] Batch of views getting replaceableComponent decorators --- src/components/views/settings/BridgeTile.tsx | 2 ++ src/components/views/settings/ChangeAvatar.js | 2 ++ src/components/views/settings/ChangeDisplayName.js | 2 ++ src/components/views/settings/ChangePassword.js | 2 ++ src/components/views/settings/CrossSigningPanel.js | 2 ++ src/components/views/settings/DevicesPanel.js | 2 ++ src/components/views/settings/DevicesPanelEntry.js | 2 ++ src/components/views/settings/EventIndexPanel.js | 2 ++ src/components/views/settings/IntegrationManager.js | 2 ++ src/components/views/settings/Notifications.js | 2 ++ src/components/views/settings/ProfileSettings.js | 2 ++ src/components/views/settings/SecureBackupPanel.js | 2 ++ src/components/views/settings/SetIdServer.js | 2 ++ src/components/views/settings/SetIntegrationManager.js | 2 ++ src/components/views/settings/SpellCheckSettings.tsx | 2 ++ src/components/views/settings/account/EmailAddresses.js | 2 ++ src/components/views/settings/account/PhoneNumbers.js | 2 ++ src/components/views/settings/discovery/EmailAddresses.js | 2 ++ src/components/views/settings/discovery/PhoneNumbers.js | 2 ++ .../views/settings/tabs/room/AdvancedRoomSettingsTab.js | 2 ++ src/components/views/settings/tabs/room/BridgeSettingsTab.tsx | 2 ++ .../views/settings/tabs/room/GeneralRoomSettingsTab.js | 2 ++ .../views/settings/tabs/room/NotificationSettingsTab.js | 2 ++ .../views/settings/tabs/room/RolesRoomSettingsTab.js | 2 ++ .../views/settings/tabs/room/SecurityRoomSettingsTab.js | 2 ++ .../views/settings/tabs/user/AppearanceUserSettingsTab.tsx | 3 ++- .../views/settings/tabs/user/FlairUserSettingsTab.js | 2 ++ .../views/settings/tabs/user/GeneralUserSettingsTab.js | 2 ++ src/components/views/settings/tabs/user/HelpUserSettingsTab.js | 2 ++ src/components/views/settings/tabs/user/LabsUserSettingsTab.js | 2 ++ .../views/settings/tabs/user/MjolnirUserSettingsTab.js | 2 ++ .../views/settings/tabs/user/NotificationUserSettingsTab.js | 2 ++ .../views/settings/tabs/user/PreferencesUserSettingsTab.js | 2 ++ .../views/settings/tabs/user/SecurityUserSettingsTab.js | 2 ++ .../views/settings/tabs/user/VoiceUserSettingsTab.js | 2 ++ src/components/views/terms/InlineTermsAgreement.js | 2 ++ src/components/views/toasts/NonUrgentEchoFailureToast.tsx | 2 ++ src/components/views/toasts/VerificationRequestToast.tsx | 2 ++ src/components/views/verification/VerificationCancelled.js | 2 ++ src/components/views/verification/VerificationComplete.js | 2 ++ src/components/views/verification/VerificationShowSas.js | 2 ++ src/components/views/voip/CallContainer.tsx | 2 ++ src/components/views/voip/CallPreview.tsx | 2 ++ src/components/views/voip/CallView.tsx | 2 ++ src/components/views/voip/CallViewForRoom.tsx | 2 ++ src/components/views/voip/DialPad.tsx | 2 ++ src/components/views/voip/DialPadModal.tsx | 2 ++ src/components/views/voip/IncomingCallBox.tsx | 2 ++ src/components/views/voip/VideoFeed.tsx | 2 ++ 49 files changed, 98 insertions(+), 1 deletion(-) diff --git a/src/components/views/settings/BridgeTile.tsx b/src/components/views/settings/BridgeTile.tsx index 58499ebd25..b33219ad4a 100644 --- a/src/components/views/settings/BridgeTile.tsx +++ b/src/components/views/settings/BridgeTile.tsx @@ -26,6 +26,7 @@ import SettingsStore from "../../../settings/SettingsStore"; import {MatrixEvent} from "matrix-js-sdk/src/models/event"; import { Room } from "matrix-js-sdk/src/models/room"; import { isUrlPermitted } from '../../../HtmlUtils'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; interface IProps { ev: MatrixEvent; @@ -64,6 +65,7 @@ interface IBridgeStateEvent { }; } +@replaceableComponent("views.settings.BridgeTile") export default class BridgeTile extends React.PureComponent { static propTypes = { ev: PropTypes.object.isRequired, diff --git a/src/components/views/settings/ChangeAvatar.js b/src/components/views/settings/ChangeAvatar.js index 7ab2936584..8067046ffd 100644 --- a/src/components/views/settings/ChangeAvatar.js +++ b/src/components/views/settings/ChangeAvatar.js @@ -20,7 +20,9 @@ import {MatrixClientPeg} from "../../../MatrixClientPeg"; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import Spinner from '../elements/Spinner'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.ChangeAvatar") export default class ChangeAvatar extends React.Component { static propTypes = { initialAvatarUrl: PropTypes.string, diff --git a/src/components/views/settings/ChangeDisplayName.js b/src/components/views/settings/ChangeDisplayName.js index 538e52d0ca..cae4a22be9 100644 --- a/src/components/views/settings/ChangeDisplayName.js +++ b/src/components/views/settings/ChangeDisplayName.js @@ -20,7 +20,9 @@ import React from 'react'; import * as sdk from '../../../index'; import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.ChangeDisplayName") export default class ChangeDisplayName extends React.Component { _getDisplayName = async () => { const cli = MatrixClientPeg.get(); diff --git a/src/components/views/settings/ChangePassword.js b/src/components/views/settings/ChangePassword.js index 22b758b1ca..aa635ef974 100644 --- a/src/components/views/settings/ChangePassword.js +++ b/src/components/views/settings/ChangePassword.js @@ -27,6 +27,7 @@ import * as sdk from "../../../index"; import Modal from "../../../Modal"; import PassphraseField from "../auth/PassphraseField"; import CountlyAnalytics from "../../../CountlyAnalytics"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; const FIELD_OLD_PASSWORD = 'field_old_password'; const FIELD_NEW_PASSWORD = 'field_new_password'; @@ -34,6 +35,7 @@ const FIELD_NEW_PASSWORD_CONFIRM = 'field_new_password_confirm'; const PASSWORD_MIN_SCORE = 3; // safely unguessable: moderate protection from offline slow-hash scenario. +@replaceableComponent("views.settings.ChangePassword") export default class ChangePassword extends React.Component { static propTypes = { onFinished: PropTypes.func, diff --git a/src/components/views/settings/CrossSigningPanel.js b/src/components/views/settings/CrossSigningPanel.js index 1c548bd9d8..e5f57d1af2 100644 --- a/src/components/views/settings/CrossSigningPanel.js +++ b/src/components/views/settings/CrossSigningPanel.js @@ -23,7 +23,9 @@ import Modal from '../../../Modal'; import Spinner from '../elements/Spinner'; import InteractiveAuthDialog from '../dialogs/InteractiveAuthDialog'; import ConfirmDestroyCrossSigningDialog from '../dialogs/security/ConfirmDestroyCrossSigningDialog'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.CrossSigningPanel") export default class CrossSigningPanel extends React.PureComponent { constructor(props) { super(props); diff --git a/src/components/views/settings/DevicesPanel.js b/src/components/views/settings/DevicesPanel.js index dc3ce9e03d..e7d300b0f8 100644 --- a/src/components/views/settings/DevicesPanel.js +++ b/src/components/views/settings/DevicesPanel.js @@ -24,7 +24,9 @@ import {MatrixClientPeg} from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; import Modal from '../../../Modal'; import {SSOAuthEntry} from "../auth/InteractiveAuthEntryComponents"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.DevicesPanel") export default class DevicesPanel extends React.Component { constructor(props) { super(props); diff --git a/src/components/views/settings/DevicesPanelEntry.js b/src/components/views/settings/DevicesPanelEntry.js index 567b144a92..93d4c78476 100644 --- a/src/components/views/settings/DevicesPanelEntry.js +++ b/src/components/views/settings/DevicesPanelEntry.js @@ -22,7 +22,9 @@ import { _t } from '../../../languageHandler'; import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {formatDate} from '../../../DateUtils'; import StyledCheckbox from '../elements/StyledCheckbox'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.DevicesPanelEntry") export default class DevicesPanelEntry extends React.Component { constructor(props) { super(props); diff --git a/src/components/views/settings/EventIndexPanel.js b/src/components/views/settings/EventIndexPanel.js index ec6ccacc9a..d78b99fc5d 100644 --- a/src/components/views/settings/EventIndexPanel.js +++ b/src/components/views/settings/EventIndexPanel.js @@ -25,7 +25,9 @@ import AccessibleButton from "../elements/AccessibleButton"; import {formatBytes, formatCountLong} from "../../../utils/FormattingUtils"; import EventIndexPeg from "../../../indexing/EventIndexPeg"; import {SettingLevel} from "../../../settings/SettingLevel"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.EventIndexPanel") export default class EventIndexPanel extends React.Component { constructor() { super(); diff --git a/src/components/views/settings/IntegrationManager.js b/src/components/views/settings/IntegrationManager.js index da11832cf5..b058625139 100644 --- a/src/components/views/settings/IntegrationManager.js +++ b/src/components/views/settings/IntegrationManager.js @@ -21,7 +21,9 @@ import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import dis from '../../../dispatcher/dispatcher'; import {Key} from "../../../Keyboard"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.IntegrationManager") export default class IntegrationManager extends React.Component { static propTypes = { // false to display an error saying that we couldn't connect to the integration manager diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 1337991dc3..25fe434994 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -32,6 +32,7 @@ import LabelledToggleSwitch from "../elements/LabelledToggleSwitch"; import AccessibleButton from "../elements/AccessibleButton"; import {SettingLevel} from "../../../settings/SettingLevel"; import {UIFeature} from "../../../settings/UIFeature"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; // TODO: this "view" component still has far too much application logic in it, // which should be factored out to other files. @@ -65,6 +66,7 @@ function portLegacyActions(actions) { } } +@replaceableComponent("views.settings.Notifications") export default class Notifications extends React.Component { static phases = { LOADING: "LOADING", // The component is loading or sending data to the hs diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index 89d7cf6c2b..30dcdc3c47 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -23,7 +23,9 @@ import * as sdk from "../../../index"; import {OwnProfileStore} from "../../../stores/OwnProfileStore"; import Modal from "../../../Modal"; import ErrorDialog from "../dialogs/ErrorDialog"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.ProfileSettings") export default class ProfileSettings extends React.Component { constructor() { super(); diff --git a/src/components/views/settings/SecureBackupPanel.js b/src/components/views/settings/SecureBackupPanel.js index 080d83b2cf..310114c8af 100644 --- a/src/components/views/settings/SecureBackupPanel.js +++ b/src/components/views/settings/SecureBackupPanel.js @@ -26,7 +26,9 @@ import AccessibleButton from '../elements/AccessibleButton'; import QuestionDialog from '../dialogs/QuestionDialog'; import RestoreKeyBackupDialog from '../dialogs/security/RestoreKeyBackupDialog'; import { accessSecretStorage } from '../../../SecurityManager'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.SecureBackupPanel") export default class SecureBackupPanel extends React.PureComponent { constructor(props) { super(props); diff --git a/src/components/views/settings/SetIdServer.js b/src/components/views/settings/SetIdServer.js index e05fe4f1c3..fa2a36476d 100644 --- a/src/components/views/settings/SetIdServer.js +++ b/src/components/views/settings/SetIdServer.js @@ -27,6 +27,7 @@ import IdentityAuthClient from "../../../IdentityAuthClient"; import {abbreviateUrl, unabbreviateUrl} from "../../../utils/UrlUtils"; import { getDefaultIdentityServerUrl, doesIdentityServerHaveTerms } from '../../../utils/IdentityServerUtils'; import {timeout} from "../../../utils/promise"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; // We'll wait up to this long when checking for 3PID bindings on the IS. const REACHABILITY_TIMEOUT = 10000; // ms @@ -58,6 +59,7 @@ async function checkIdentityServerUrl(u) { } } +@replaceableComponent("views.settings.SetIdServer") export default class SetIdServer extends React.Component { static propTypes = { // Whether or not the ID server is missing terms. This affects the text diff --git a/src/components/views/settings/SetIntegrationManager.js b/src/components/views/settings/SetIntegrationManager.js index e6fb3f6e1c..29cc5d7131 100644 --- a/src/components/views/settings/SetIntegrationManager.js +++ b/src/components/views/settings/SetIntegrationManager.js @@ -20,7 +20,9 @@ import {IntegrationManagers} from "../../../integrations/IntegrationManagers"; import * as sdk from '../../../index'; import SettingsStore from "../../../settings/SettingsStore"; import {SettingLevel} from "../../../settings/SettingLevel"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.SetIntegrationManager") export default class SetIntegrationManager extends React.Component { constructor() { super(); diff --git a/src/components/views/settings/SpellCheckSettings.tsx b/src/components/views/settings/SpellCheckSettings.tsx index d08f263b5f..e5455c8c68 100644 --- a/src/components/views/settings/SpellCheckSettings.tsx +++ b/src/components/views/settings/SpellCheckSettings.tsx @@ -18,6 +18,7 @@ import React from 'react'; import SpellCheckLanguagesDropdown from "../../../components/views/elements/SpellCheckLanguagesDropdown"; import AccessibleButton from "../../../components/views/elements/AccessibleButton"; import {_t} from "../../../languageHandler"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; interface ExistingSpellCheckLanguageIProps { language: string, @@ -53,6 +54,7 @@ export class ExistingSpellCheckLanguage extends React.Component { constructor(props) { super(props); diff --git a/src/components/views/settings/account/EmailAddresses.js b/src/components/views/settings/account/EmailAddresses.js index a8de7693a9..1ebd374173 100644 --- a/src/components/views/settings/account/EmailAddresses.js +++ b/src/components/views/settings/account/EmailAddresses.js @@ -25,6 +25,7 @@ import * as Email from "../../../../email"; import AddThreepid from "../../../../AddThreepid"; import * as sdk from '../../../../index'; import Modal from '../../../../Modal'; +import {replaceableComponent} from "../../../../utils/replaceableComponent"; /* TODO: Improve the UX for everything in here. @@ -112,6 +113,7 @@ export class ExistingEmailAddress extends React.Component { } } +@replaceableComponent("views.settings.account.EmailAddresses") export default class EmailAddresses extends React.Component { static propTypes = { emails: PropTypes.array.isRequired, diff --git a/src/components/views/settings/account/PhoneNumbers.js b/src/components/views/settings/account/PhoneNumbers.js index df54b5ca1f..5725fdb909 100644 --- a/src/components/views/settings/account/PhoneNumbers.js +++ b/src/components/views/settings/account/PhoneNumbers.js @@ -25,6 +25,7 @@ import AddThreepid from "../../../../AddThreepid"; import CountryDropdown from "../../auth/CountryDropdown"; import * as sdk from '../../../../index'; import Modal from '../../../../Modal'; +import {replaceableComponent} from "../../../../utils/replaceableComponent"; /* TODO: Improve the UX for everything in here. @@ -107,6 +108,7 @@ export class ExistingPhoneNumber extends React.Component { } } +@replaceableComponent("views.settings.account.PhoneNumbers") export default class PhoneNumbers extends React.Component { static propTypes = { msisdns: PropTypes.array.isRequired, diff --git a/src/components/views/settings/discovery/EmailAddresses.js b/src/components/views/settings/discovery/EmailAddresses.js index f9a1ba1818..0493597537 100644 --- a/src/components/views/settings/discovery/EmailAddresses.js +++ b/src/components/views/settings/discovery/EmailAddresses.js @@ -23,6 +23,7 @@ import {MatrixClientPeg} from "../../../../MatrixClientPeg"; import * as sdk from '../../../../index'; import Modal from '../../../../Modal'; import AddThreepid from '../../../../AddThreepid'; +import {replaceableComponent} from "../../../../utils/replaceableComponent"; /* TODO: Improve the UX for everything in here. @@ -233,6 +234,7 @@ export class EmailAddress extends React.Component { } } +@replaceableComponent("views.settings.discovery.EmailAddresses") export default class EmailAddresses extends React.Component { static propTypes = { emails: PropTypes.array.isRequired, diff --git a/src/components/views/settings/discovery/PhoneNumbers.js b/src/components/views/settings/discovery/PhoneNumbers.js index 03f459ee15..5cbcdfe47e 100644 --- a/src/components/views/settings/discovery/PhoneNumbers.js +++ b/src/components/views/settings/discovery/PhoneNumbers.js @@ -23,6 +23,7 @@ import {MatrixClientPeg} from "../../../../MatrixClientPeg"; import * as sdk from '../../../../index'; import Modal from '../../../../Modal'; import AddThreepid from '../../../../AddThreepid'; +import {replaceableComponent} from "../../../../utils/replaceableComponent"; /* TODO: Improve the UX for everything in here. @@ -246,6 +247,7 @@ export class PhoneNumber extends React.Component { } } +@replaceableComponent("views.settings.discovery.PhoneNumbers") export default class PhoneNumbers extends React.Component { static propTypes = { msisdns: PropTypes.array.isRequired, diff --git a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js index 2fa61a0ee6..28aad65129 100644 --- a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js @@ -22,7 +22,9 @@ import * as sdk from "../../../../.."; import AccessibleButton from "../../../elements/AccessibleButton"; import Modal from "../../../../../Modal"; import dis from "../../../../../dispatcher/dispatcher"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.room.AdvancedRoomSettingsTab") export default class AdvancedRoomSettingsTab extends React.Component { static propTypes = { roomId: PropTypes.string.isRequired, diff --git a/src/components/views/settings/tabs/room/BridgeSettingsTab.tsx b/src/components/views/settings/tabs/room/BridgeSettingsTab.tsx index 3c74bd4c1a..8d886a191e 100644 --- a/src/components/views/settings/tabs/room/BridgeSettingsTab.tsx +++ b/src/components/views/settings/tabs/room/BridgeSettingsTab.tsx @@ -21,6 +21,7 @@ import {MatrixEvent} from "matrix-js-sdk/src/models/event"; import {_t} from "../../../../../languageHandler"; import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import BridgeTile from "../../BridgeTile"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; const BRIDGE_EVENT_TYPES = [ "uk.half-shot.bridge", @@ -33,6 +34,7 @@ interface IProps { roomId: string; } +@replaceableComponent("views.settings.tabs.room.BridgeSettingsTab") export default class BridgeSettingsTab extends React.Component { private renderBridgeCard(event: MatrixEvent, room: Room) { const content = event.getContent(); diff --git a/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js b/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js index 9b8004d9d6..cd4a043622 100644 --- a/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js @@ -24,7 +24,9 @@ import dis from "../../../../../dispatcher/dispatcher"; import MatrixClientContext from "../../../../../contexts/MatrixClientContext"; import SettingsStore from "../../../../../settings/SettingsStore"; import {UIFeature} from "../../../../../settings/UIFeature"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.room.GeneralRoomSettingsTab") export default class GeneralRoomSettingsTab extends React.Component { static propTypes = { roomId: PropTypes.string.isRequired, diff --git a/src/components/views/settings/tabs/room/NotificationSettingsTab.js b/src/components/views/settings/tabs/room/NotificationSettingsTab.js index dd88b5018f..baefb5ae20 100644 --- a/src/components/views/settings/tabs/room/NotificationSettingsTab.js +++ b/src/components/views/settings/tabs/room/NotificationSettingsTab.js @@ -22,7 +22,9 @@ import AccessibleButton from "../../../elements/AccessibleButton"; import Notifier from "../../../../../Notifier"; import SettingsStore from '../../../../../settings/SettingsStore'; import {SettingLevel} from "../../../../../settings/SettingLevel"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.room.NotificationsSettingsTab") export default class NotificationsSettingsTab extends React.Component { static propTypes = { roomId: PropTypes.string.isRequired, diff --git a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js index 49d683c42a..09498e0d4a 100644 --- a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js @@ -21,6 +21,7 @@ import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as sdk from "../../../../.."; import AccessibleButton from "../../../elements/AccessibleButton"; import Modal from "../../../../../Modal"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; const plEventsToLabels = { // These will be translated for us later. @@ -103,6 +104,7 @@ export class BannedUser extends React.Component { } } +@replaceableComponent("views.settings.tabs.room.RolesRoomSettingsTab") export default class RolesRoomSettingsTab extends React.Component { static propTypes = { roomId: PropTypes.string.isRequired, diff --git a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js index f72e78fa3f..ce883c6d23 100644 --- a/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.js @@ -26,7 +26,9 @@ import StyledRadioGroup from '../../../elements/StyledRadioGroup'; import {SettingLevel} from "../../../../../settings/SettingLevel"; import SettingsStore from "../../../../../settings/SettingsStore"; import {UIFeature} from "../../../../../settings/UIFeature"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.room.SecurityRoomSettingsTab") export default class SecurityRoomSettingsTab extends React.Component { static propTypes = { roomId: PropTypes.string.isRequired, diff --git a/src/components/views/settings/tabs/user/AppearanceUserSettingsTab.tsx b/src/components/views/settings/tabs/user/AppearanceUserSettingsTab.tsx index 80a20d8afa..d6e01d194c 100644 --- a/src/components/views/settings/tabs/user/AppearanceUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/AppearanceUserSettingsTab.tsx @@ -36,6 +36,7 @@ import StyledRadioGroup from "../../../elements/StyledRadioGroup"; import { SettingLevel } from "../../../../../settings/SettingLevel"; import {UIFeature} from "../../../../../settings/UIFeature"; import {Layout} from "../../../../../settings/Layout"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; interface IProps { } @@ -64,7 +65,7 @@ interface IState extends IThemeState { layout: Layout; } - +@replaceableComponent("views.settings.tabs.user.AppearanceUserSettingsTab") export default class AppearanceUserSettingsTab extends React.Component { private readonly MESSAGE_PREVIEW_TEXT = _t("Hey you. You're the best!"); diff --git a/src/components/views/settings/tabs/user/FlairUserSettingsTab.js b/src/components/views/settings/tabs/user/FlairUserSettingsTab.js index 26e0033233..28e80f3030 100644 --- a/src/components/views/settings/tabs/user/FlairUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/FlairUserSettingsTab.js @@ -17,7 +17,9 @@ limitations under the License. import React from 'react'; import {_t} from "../../../../../languageHandler"; import GroupUserSettings from "../../../groups/GroupUserSettings"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.user.FlairUserSettingsTab") export default class FlairUserSettingsTab extends React.Component { render() { return ( diff --git a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js index b17ab18c39..314acf5d65 100644 --- a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js @@ -39,7 +39,9 @@ import { getThreepidsWithBindStatus } from '../../../../../boundThreepids'; import Spinner from "../../../elements/Spinner"; import {SettingLevel} from "../../../../../settings/SettingLevel"; import {UIFeature} from "../../../../../settings/UIFeature"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.user.GeneralUserSettingsTab") export default class GeneralUserSettingsTab extends React.Component { static propTypes = { closeSettingsFn: PropTypes.func.isRequired, diff --git a/src/components/views/settings/tabs/user/HelpUserSettingsTab.js b/src/components/views/settings/tabs/user/HelpUserSettingsTab.js index 85ba22a353..e16ee686f5 100644 --- a/src/components/views/settings/tabs/user/HelpUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/HelpUserSettingsTab.js @@ -27,7 +27,9 @@ import * as sdk from "../../../../../"; import PlatformPeg from "../../../../../PlatformPeg"; import * as KeyboardShortcuts from "../../../../../accessibility/KeyboardShortcuts"; import UpdateCheckButton from "../../UpdateCheckButton"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.user.HelpUserSettingsTab") export default class HelpUserSettingsTab extends React.Component { static propTypes = { closeSettingsFn: PropTypes.func.isRequired, diff --git a/src/components/views/settings/tabs/user/LabsUserSettingsTab.js b/src/components/views/settings/tabs/user/LabsUserSettingsTab.js index 91bc9abcad..f515f1862b 100644 --- a/src/components/views/settings/tabs/user/LabsUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/LabsUserSettingsTab.js @@ -21,6 +21,7 @@ import SettingsStore from "../../../../../settings/SettingsStore"; import LabelledToggleSwitch from "../../../elements/LabelledToggleSwitch"; import * as sdk from "../../../../../index"; import {SettingLevel} from "../../../../../settings/SettingLevel"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; export class LabsSettingToggle extends React.Component { static propTypes = { @@ -40,6 +41,7 @@ export class LabsSettingToggle extends React.Component { } } +@replaceableComponent("views.settings.tabs.user.LabsUserSettingsTab") export default class LabsUserSettingsTab extends React.Component { constructor() { super(); diff --git a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js index 510d6076a0..91f6728a7a 100644 --- a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js @@ -23,7 +23,9 @@ import {BanList, RULE_SERVER, RULE_USER} from "../../../../../mjolnir/BanList"; import Modal from "../../../../../Modal"; import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as sdk from "../../../../../index"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.user.MjolnirUserSettingsTab") export default class MjolnirUserSettingsTab extends React.Component { constructor() { super(); diff --git a/src/components/views/settings/tabs/user/NotificationUserSettingsTab.js b/src/components/views/settings/tabs/user/NotificationUserSettingsTab.js index 2e649cb7f8..8a71d1bf15 100644 --- a/src/components/views/settings/tabs/user/NotificationUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/NotificationUserSettingsTab.js @@ -17,7 +17,9 @@ limitations under the License. import React from 'react'; import {_t} from "../../../../../languageHandler"; import * as sdk from "../../../../../index"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.user.NotificationUserSettingsTab") export default class NotificationUserSettingsTab extends React.Component { constructor() { super(); diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js index ae9cad4cfa..238f875e22 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js @@ -23,7 +23,9 @@ import Field from "../../../elements/Field"; import * as sdk from "../../../../.."; import PlatformPeg from "../../../../../PlatformPeg"; import {SettingLevel} from "../../../../../settings/SettingLevel"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.user.PreferencesUserSettingsTab") export default class PreferencesUserSettingsTab extends React.Component { static ROOM_LIST_SETTINGS = [ 'breadcrumbs', diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index a0d9016ce2..8a70811399 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -34,6 +34,7 @@ import SettingsStore from "../../../../../settings/SettingsStore"; import {UIFeature} from "../../../../../settings/UIFeature"; import {isE2eAdvancedPanelPossible} from "../../E2eAdvancedPanel"; import CountlyAnalytics from "../../../../../CountlyAnalytics"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; export class IgnoredUser extends React.Component { static propTypes = { @@ -59,6 +60,7 @@ export class IgnoredUser extends React.Component { } } +@replaceableComponent("views.settings.tabs.user.SecurityUserSettingsTab") export default class SecurityUserSettingsTab extends React.Component { static propTypes = { closeSettingsFn: PropTypes.func.isRequired, diff --git a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js index a78cc10b92..bc6fe796b8 100644 --- a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js @@ -25,7 +25,9 @@ import {MatrixClientPeg} from "../../../../../MatrixClientPeg"; import * as sdk from "../../../../../index"; import Modal from "../../../../../Modal"; import {SettingLevel} from "../../../../../settings/SettingLevel"; +import {replaceableComponent} from "../../../../../utils/replaceableComponent"; +@replaceableComponent("views.settings.tabs.user.VoiceUserSettingsTab") export default class VoiceUserSettingsTab extends React.Component { constructor() { super(); diff --git a/src/components/views/terms/InlineTermsAgreement.js b/src/components/views/terms/InlineTermsAgreement.js index 5f6e276976..473a97642c 100644 --- a/src/components/views/terms/InlineTermsAgreement.js +++ b/src/components/views/terms/InlineTermsAgreement.js @@ -20,7 +20,9 @@ import {_t, pickBestLanguage} from "../../../languageHandler"; import * as sdk from "../../.."; import {objectClone} from "../../../utils/objects"; import StyledCheckbox from "../elements/StyledCheckbox"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.terms.InlineTermsAgreement") export default class InlineTermsAgreement extends React.Component { static propTypes = { policiesAndServicePairs: PropTypes.array.isRequired, // array of service/policy pairs diff --git a/src/components/views/toasts/NonUrgentEchoFailureToast.tsx b/src/components/views/toasts/NonUrgentEchoFailureToast.tsx index 76d0328e8b..abf5b10692 100644 --- a/src/components/views/toasts/NonUrgentEchoFailureToast.tsx +++ b/src/components/views/toasts/NonUrgentEchoFailureToast.tsx @@ -19,7 +19,9 @@ import { _t } from "../../../languageHandler"; import AccessibleButton from "../elements/AccessibleButton"; import Modal from "../../../Modal"; import ServerOfflineDialog from "../dialogs/ServerOfflineDialog"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.toasts.NonUrgentEchoFailureToast") export default class NonUrgentEchoFailureToast extends React.PureComponent { private openDialog = () => { Modal.createTrackedDialog('Local Echo Server Error', '', ServerOfflineDialog, {}); diff --git a/src/components/views/toasts/VerificationRequestToast.tsx b/src/components/views/toasts/VerificationRequestToast.tsx index 8c8a74b2be..010c8fd12f 100644 --- a/src/components/views/toasts/VerificationRequestToast.tsx +++ b/src/components/views/toasts/VerificationRequestToast.tsx @@ -29,6 +29,7 @@ import GenericToast from "./GenericToast"; import {VerificationRequest} from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest"; import {DeviceInfo} from "matrix-js-sdk/src/crypto/deviceinfo"; import {Action} from "../../../dispatcher/actions"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; interface IProps { toastKey: string; @@ -40,6 +41,7 @@ interface IState { device?: DeviceInfo; } +@replaceableComponent("views.toasts.VerificationRequestToast") export default class VerificationRequestToast extends React.PureComponent { private intervalHandle: NodeJS.Timeout; diff --git a/src/components/views/verification/VerificationCancelled.js b/src/components/views/verification/VerificationCancelled.js index fc2a287359..0bbaea1804 100644 --- a/src/components/views/verification/VerificationCancelled.js +++ b/src/components/views/verification/VerificationCancelled.js @@ -18,7 +18,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.verification.VerificationCancelled") export default class VerificationCancelled extends React.Component { static propTypes = { onDone: PropTypes.func.isRequired, diff --git a/src/components/views/verification/VerificationComplete.js b/src/components/views/verification/VerificationComplete.js index 2214711b1f..cf2a72591c 100644 --- a/src/components/views/verification/VerificationComplete.js +++ b/src/components/views/verification/VerificationComplete.js @@ -18,7 +18,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; +@replaceableComponent("views.verification.VerificationComplete") export default class VerificationComplete extends React.Component { static propTypes = { onDone: PropTypes.func.isRequired, diff --git a/src/components/views/verification/VerificationShowSas.js b/src/components/views/verification/VerificationShowSas.js index 09374b91af..36f99b2140 100644 --- a/src/components/views/verification/VerificationShowSas.js +++ b/src/components/views/verification/VerificationShowSas.js @@ -21,11 +21,13 @@ import {PendingActionSpinner} from "../right_panel/EncryptionInfo"; import AccessibleButton from "../elements/AccessibleButton"; import DialogButtons from "../elements/DialogButtons"; import { fixupColorFonts } from '../../../utils/FontManager'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; function capFirst(s) { return s.charAt(0).toUpperCase() + s.slice(1); } +@replaceableComponent("views.verification.VerificationShowSas") export default class VerificationShowSas extends React.Component { static propTypes = { pending: PropTypes.bool, diff --git a/src/components/views/voip/CallContainer.tsx b/src/components/views/voip/CallContainer.tsx index 51925cb147..9d0047fc54 100644 --- a/src/components/views/voip/CallContainer.tsx +++ b/src/components/views/voip/CallContainer.tsx @@ -17,6 +17,7 @@ limitations under the License. import React from 'react'; import IncomingCallBox from './IncomingCallBox'; import CallPreview from './CallPreview'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; interface IProps { @@ -26,6 +27,7 @@ interface IState { } +@replaceableComponent("views.voip.CallContainer") export default class CallContainer extends React.PureComponent { public render() { return
diff --git a/src/components/views/voip/CallPreview.tsx b/src/components/views/voip/CallPreview.tsx index c08e52181b..29de068b0c 100644 --- a/src/components/views/voip/CallPreview.tsx +++ b/src/components/views/voip/CallPreview.tsx @@ -26,6 +26,7 @@ import PersistentApp from "../elements/PersistentApp"; import SettingsStore from "../../../settings/SettingsStore"; import { CallEvent, CallState, MatrixCall } from 'matrix-js-sdk/src/webrtc/call'; import { MatrixClientPeg } from '../../../MatrixClientPeg'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; const SHOW_CALL_IN_STATES = [ CallState.Connected, @@ -85,6 +86,7 @@ function getPrimarySecondaryCalls(calls: MatrixCall[]): [MatrixCall, MatrixCall[ * CallPreview shows a small version of CallView hovering over the UI in 'picture-in-picture' * (PiP mode). It displays the call(s) which is *not* in the room the user is currently viewing. */ +@replaceableComponent("views.voip.CallPreview") export default class CallPreview extends React.Component { private roomStoreToken: any; private dispatcherRef: string; diff --git a/src/components/views/voip/CallView.tsx b/src/components/views/voip/CallView.tsx index 7cac682794..9bdc8fb11d 100644 --- a/src/components/views/voip/CallView.tsx +++ b/src/components/views/voip/CallView.tsx @@ -31,6 +31,7 @@ import {alwaysAboveLeftOf, alwaysAboveRightOf, ChevronFace, ContextMenuButton} f import CallContextMenu from '../context_menus/CallContextMenu'; import { avatarUrlForMember } from '../../../Avatar'; import DialpadContextMenu from '../context_menus/DialpadContextMenu'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; interface IProps { // The call for us to display @@ -100,6 +101,7 @@ const BOTTOM_PADDING = 10; const BOTTOM_MARGIN_TOP_BOTTOM = 10; // top margin plus bottom margin const CONTEXT_MENU_VPADDING = 8; // How far the context menu sits above the button (px) +@replaceableComponent("views.voip.CallView") export default class CallView extends React.Component { private dispatcherRef: string; private contentRef = createRef(); diff --git a/src/components/views/voip/CallViewForRoom.tsx b/src/components/views/voip/CallViewForRoom.tsx index 4cb4e66fbe..97960d1e0b 100644 --- a/src/components/views/voip/CallViewForRoom.tsx +++ b/src/components/views/voip/CallViewForRoom.tsx @@ -19,6 +19,7 @@ import React from 'react'; import CallHandler from '../../../CallHandler'; import CallView from './CallView'; import dis from '../../../dispatcher/dispatcher'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; interface IProps { // What room we should display the call for @@ -40,6 +41,7 @@ interface IState { * Wrapper for CallView that always display the call in a given room, * or nothing if there is no call in that room. */ +@replaceableComponent("views.voip.CallViewForRoom") export default class CallViewForRoom extends React.Component { private dispatcherRef: string; diff --git a/src/components/views/voip/DialPad.tsx b/src/components/views/voip/DialPad.tsx index da88f49adf..3598f511f5 100644 --- a/src/components/views/voip/DialPad.tsx +++ b/src/components/views/voip/DialPad.tsx @@ -16,6 +16,7 @@ limitations under the License. import * as React from "react"; import AccessibleButton from "../elements/AccessibleButton"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; const BUTTONS = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#']; @@ -59,6 +60,7 @@ interface IProps { onDialPress?: (string) => void; } +@replaceableComponent("views.voip.Dialpad") export default class Dialpad extends React.PureComponent { render() { const buttonNodes = []; diff --git a/src/components/views/voip/DialPadModal.tsx b/src/components/views/voip/DialPadModal.tsx index 9f031a48a3..c085809d5a 100644 --- a/src/components/views/voip/DialPadModal.tsx +++ b/src/components/views/voip/DialPadModal.tsx @@ -25,6 +25,7 @@ import dis from '../../../dispatcher/dispatcher'; import Modal from "../../../Modal"; import ErrorDialog from "../../views/dialogs/ErrorDialog"; import CallHandler from "../../../CallHandler"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; interface IProps { onFinished: (boolean) => void; @@ -34,6 +35,7 @@ interface IState { value: string; } +@replaceableComponent("views.voip.DialpadModal") export default class DialpadModal extends React.PureComponent { constructor(props) { super(props); diff --git a/src/components/views/voip/IncomingCallBox.tsx b/src/components/views/voip/IncomingCallBox.tsx index a495093d85..0ca2a196c2 100644 --- a/src/components/views/voip/IncomingCallBox.tsx +++ b/src/components/views/voip/IncomingCallBox.tsx @@ -25,6 +25,7 @@ import CallHandler from '../../../CallHandler'; import RoomAvatar from '../avatars/RoomAvatar'; import FormButton from '../elements/FormButton'; import { CallState } from 'matrix-js-sdk/src/webrtc/call'; +import {replaceableComponent} from "../../../utils/replaceableComponent"; interface IProps { } @@ -33,6 +34,7 @@ interface IState { incomingCall: any; } +@replaceableComponent("views.voip.IncomingCallBox") export default class IncomingCallBox extends React.Component { private dispatcherRef: string; diff --git a/src/components/views/voip/VideoFeed.tsx b/src/components/views/voip/VideoFeed.tsx index 5210f28eb1..23dbe4d46b 100644 --- a/src/components/views/voip/VideoFeed.tsx +++ b/src/components/views/voip/VideoFeed.tsx @@ -18,6 +18,7 @@ import classnames from 'classnames'; import { MatrixCall } from 'matrix-js-sdk/src/webrtc/call'; import React, {createRef} from 'react'; import SettingsStore from "../../../settings/SettingsStore"; +import {replaceableComponent} from "../../../utils/replaceableComponent"; export enum VideoFeedType { Local, @@ -37,6 +38,7 @@ interface IProps { onResize?: (e: Event) => void, } +@replaceableComponent("views.voip.VideoFeed") export default class VideoFeed extends React.Component { private vid = createRef();