From d4af8d4993d305b34b5eef8cff05516f5e3a24b0 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 9 Jul 2019 18:56:39 +0100 Subject: [PATCH] Use showIntegrationsManager in other places --- src/FromWidgetPostMessageApi.js | 7 +++---- src/components/views/elements/AppTile.js | 7 +++---- src/components/views/rooms/Stickerpicker.js | 8 +++----- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/FromWidgetPostMessageApi.js b/src/FromWidgetPostMessageApi.js index 79e5206f50..02c5112d81 100644 --- a/src/FromWidgetPostMessageApi.js +++ b/src/FromWidgetPostMessageApi.js @@ -23,6 +23,7 @@ import sdk from "./index"; import Modal from "./Modal"; import MatrixClientPeg from "./MatrixClientPeg"; import RoomViewStore from "./stores/RoomViewStore"; +import { showIntegrationsManager } from './integrations/integrations'; const WIDGET_API_VERSION = '0.0.2'; // Current API version const SUPPORTED_WIDGET_API_VERSIONS = [ @@ -193,13 +194,11 @@ export default class FromWidgetPostMessageApi { const integType = (data && data.integType) ? data.integType : null; const integId = (data && data.integId) ? data.integId : null; - // The dialog will take care of scalar auth for us - const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager"); - Modal.createTrackedDialog('Integrations Manager', '', IntegrationsManager, { + showIntegrationsManager({ room: MatrixClientPeg.get().getRoom(RoomViewStore.getRoomId()), screen: 'type_' + integType, integrationId: integId, - }, "mx_IntegrationsManager"); + }); } else if (action === 'set_always_on_screen') { // This is a new message: there is no reason to support the deprecated widgetData here const data = event.data.data; diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 034a3318a5..7df01ff599 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -35,6 +35,7 @@ import WidgetUtils from '../../../utils/WidgetUtils'; import dis from '../../../dispatcher'; import ActiveWidgetStore from '../../../stores/ActiveWidgetStore'; import classNames from 'classnames'; +import { showIntegrationsManager } from '../../../integrations/integrations'; const ALLOWED_APP_URL_SCHEMES = ['https:', 'http:']; const ENABLE_REACT_PERF = false; @@ -240,13 +241,11 @@ export default class AppTile extends React.Component { if (this.props.onEditClick) { this.props.onEditClick(); } else { - // The dialog handles scalar auth for us - const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager"); - Modal.createTrackedDialog('Integrations Manager', '', IntegrationsManager, { + showIntegrationsManager({ room: this.props.room, screen: 'type_' + this.props.type, integrationId: this.props.id, - }, "mx_IntegrationsManager"); + }); } } diff --git a/src/components/views/rooms/Stickerpicker.js b/src/components/views/rooms/Stickerpicker.js index 6918810842..fe1d4f0f7f 100644 --- a/src/components/views/rooms/Stickerpicker.js +++ b/src/components/views/rooms/Stickerpicker.js @@ -25,6 +25,7 @@ import AccessibleButton from '../elements/AccessibleButton'; import WidgetUtils from '../../../utils/WidgetUtils'; import ActiveWidgetStore from '../../../stores/ActiveWidgetStore'; import PersistedElement from "../elements/PersistedElement"; +import { showIntegrationsManager } from '../../../integrations/integrations'; const widgetType = 'm.stickerpicker'; @@ -348,14 +349,11 @@ export default class Stickerpicker extends React.Component { * Launch the integrations manager on the stickers integration page */ _launchManageIntegrations() { - const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager"); - - // The integrations manager will handle scalar auth for us. - Modal.createTrackedDialog('Integrations Manager', '', IntegrationsManager, { + showIntegrationsManager({ room: this.props.room, screen: `type_${widgetType}`, integrationId: this.state.widgetId, - }, "mx_IntegrationsManager"); + }); } render() {