Step 8.5: Move tabbed integration manager dialog construction
This commit is contained in:
parent
226700ba95
commit
bcf413734b
4 changed files with 59 additions and 6 deletions
|
@ -277,4 +277,10 @@ export enum Action {
|
|||
* Payload: OpenReportEventDialogPayload.
|
||||
*/
|
||||
OpenReportEventDialog = "open_report_event_dialog",
|
||||
|
||||
/**
|
||||
* Fired when the tabbed integration manager dialog needs to be opened.
|
||||
* Payload: OpenTabbedIntegrationManagerDialogPayload
|
||||
*/
|
||||
OpenTabbedIntegrationManagerDialog = "open_tabbed_imanager_dialog",
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { Optional } from "matrix-events-sdk";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface OpenTabbedIntegrationManagerDialogPayload extends ActionPayload {
|
||||
action: Action.OpenTabbedIntegrationManagerDialog;
|
||||
|
||||
room: Optional<Room>;
|
||||
screen: Optional<string>;
|
||||
integrationId: Optional<string>;
|
||||
}
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
import url from 'url';
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { MatrixClient, ClientEvent } from "matrix-js-sdk/src/client";
|
||||
import { ClientEvent, MatrixClient } from "matrix-js-sdk/src/client";
|
||||
|
||||
import type { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import type { Room } from "matrix-js-sdk/src/models/room";
|
||||
|
@ -24,12 +24,16 @@ import SdkConfig from '../SdkConfig';
|
|||
import Modal from '../Modal';
|
||||
import { IntegrationManagerInstance, Kind } from "./IntegrationManagerInstance";
|
||||
import IntegrationsImpossibleDialog from "../components/views/dialogs/IntegrationsImpossibleDialog";
|
||||
import TabbedIntegrationManagerDialog from "../components/views/dialogs/TabbedIntegrationManagerDialog";
|
||||
import IntegrationsDisabledDialog from "../components/views/dialogs/IntegrationsDisabledDialog";
|
||||
import WidgetUtils from "../utils/WidgetUtils";
|
||||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
import { compare } from "../utils/strings";
|
||||
import defaultDispatcher from "../dispatcher/dispatcher";
|
||||
import {
|
||||
OpenTabbedIntegrationManagerDialogPayload,
|
||||
} from "../dispatcher/payloads/OpenTabbedIntegrationManagerDialogPayload";
|
||||
import { Action } from "../dispatcher/actions";
|
||||
|
||||
const KIND_PREFERENCE = [
|
||||
// Ordered: first is most preferred, last is least preferred.
|
||||
|
@ -186,10 +190,12 @@ export class IntegrationManagers {
|
|||
return this.openNoManagerDialog();
|
||||
}
|
||||
|
||||
Modal.createTrackedDialog(
|
||||
'Tabbed Integration Manager', '', TabbedIntegrationManagerDialog,
|
||||
{ room, screen, integrationId }, 'mx_TabbedIntegrationManagerDialog',
|
||||
);
|
||||
defaultDispatcher.dispatch(<OpenTabbedIntegrationManagerDialogPayload>{
|
||||
action: Action.OpenTabbedIntegrationManagerDialog,
|
||||
room,
|
||||
screen,
|
||||
integrationId,
|
||||
});
|
||||
}
|
||||
|
||||
showDisabledDialog(): void {
|
||||
|
|
|
@ -23,6 +23,7 @@ import ForwardDialog from "../components/views/dialogs/ForwardDialog";
|
|||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
import { Action } from "../dispatcher/actions";
|
||||
import ReportEventDialog from "../components/views/dialogs/ReportEventDialog";
|
||||
import TabbedIntegrationManagerDialog from "../components/views/dialogs/TabbedIntegrationManagerDialog";
|
||||
|
||||
/**
|
||||
* Auxiliary class to listen for dialog opening over the dispatcher and
|
||||
|
@ -65,6 +66,17 @@ export class DialogOpener {
|
|||
event: payload.event,
|
||||
}, 'mx_Dialog_reportEvent');
|
||||
break;
|
||||
case Action.OpenTabbedIntegrationManagerDialog:
|
||||
Modal.createTrackedDialog(
|
||||
'Tabbed Integration Manager', '', TabbedIntegrationManagerDialog,
|
||||
{
|
||||
room: payload.room,
|
||||
screen: payload.screen,
|
||||
integrationId: payload.integrationId,
|
||||
},
|
||||
'mx_TabbedIntegrationManagerDialog',
|
||||
);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue