mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-05 20:26:19 +02:00
Switch to using module api via .instance
This commit is contained in:
parent
ced886aa07
commit
2dd743dea0
@ -68,7 +68,7 @@ import { monitorSyncedPushRules } from "../../utils/pushRules/monitorSyncedPushR
|
||||
import { type ConfigOptions } from "../../SdkConfig";
|
||||
import { MatrixClientContextProvider } from "./MatrixClientContextProvider";
|
||||
import { Landmark, LandmarkNavigation } from "../../accessibility/LandmarkNavigation";
|
||||
import ModuleApi from "../../modules/Api.ts";
|
||||
import { ModuleApi } from "../../modules/Api.ts";
|
||||
import { SDKContext } from "../../contexts/SDKContext.ts";
|
||||
|
||||
// We need to fetch each pinned message individually (if we don't already have it)
|
||||
@ -681,7 +681,7 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||
let pageElement;
|
||||
|
||||
const moduleRenderer = this.props.page_type
|
||||
? ModuleApi.navigation.locationRenderers.get(this.props.page_type)
|
||||
? ModuleApi.instance.navigation.locationRenderers.get(this.props.page_type)
|
||||
: undefined;
|
||||
|
||||
switch (this.props.page_type) {
|
||||
|
||||
@ -140,7 +140,7 @@ import { ShareFormat, type SharePayload } from "../../dispatcher/payloads/ShareP
|
||||
import Markdown from "../../Markdown";
|
||||
import { sanitizeHtmlParams } from "../../Linkify";
|
||||
import { isOnlyAdmin } from "../../utils/membership";
|
||||
import ModuleApi from "../../modules/Api.ts";
|
||||
import { ModuleApi } from "../../modules/Api.ts";
|
||||
|
||||
// legacy export
|
||||
export { default as Views } from "../../Views";
|
||||
@ -1925,7 +1925,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
subAction: params?.action,
|
||||
});
|
||||
} else {
|
||||
if (ModuleApi.navigation.locationRenderers.get(screen)) {
|
||||
if (ModuleApi.instance.navigation.locationRenderers.get(screen)) {
|
||||
this.setState({ page_type: screen });
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ import { ThreadsActivityCentre } from "./threads-activity-centre/";
|
||||
import AccessibleButton from "../elements/AccessibleButton";
|
||||
import { Landmark, LandmarkNavigation } from "../../../accessibility/LandmarkNavigation";
|
||||
import { KeyboardShortcut } from "../settings/KeyboardShortcut";
|
||||
import ModuleApi from "../../../modules/Api.ts";
|
||||
import { ModuleApi } from "../../../modules/Api.ts";
|
||||
import { useModuleSpacePanelItems } from "../../../modules/ExtrasApi.ts";
|
||||
import { ReleaseAnnouncement } from "../../structures/ReleaseAnnouncement";
|
||||
|
||||
@ -292,7 +292,7 @@ const InnerSpacePanel = React.memo<IInnerSpacePanelProps>(
|
||||
const [invites, metaSpaces, actualSpaces, activeSpace] = useSpaces();
|
||||
const activeSpaces = activeSpace ? [activeSpace] : [];
|
||||
|
||||
const moduleSpaceItems = useModuleSpacePanelItems(ModuleApi.extras);
|
||||
const moduleSpaceItems = useModuleSpacePanelItems(ModuleApi.instance.extras);
|
||||
|
||||
const metaSpacesSection = metaSpaces
|
||||
.filter((key) => !(key === MetaSpace.VideoRooms && !SettingsStore.getValue("feature_video_rooms")))
|
||||
|
||||
@ -62,7 +62,7 @@ import { type ViewHomePagePayload } from "../../dispatcher/payloads/ViewHomePage
|
||||
import { type SwitchSpacePayload } from "../../dispatcher/payloads/SwitchSpacePayload";
|
||||
import { type AfterLeaveRoomPayload } from "../../dispatcher/payloads/AfterLeaveRoomPayload";
|
||||
import { SdkContextClass } from "../../contexts/SDKContext";
|
||||
import ModuleApi from "../../modules/Api.ts";
|
||||
import { ModuleApi } from "../../modules/Api.ts";
|
||||
|
||||
const ACTIVE_SPACE_LS_KEY = "mx_active_space";
|
||||
|
||||
@ -254,7 +254,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<EmptyObject> {
|
||||
if (!space || !this.matrixClient || space === this.activeSpace) return;
|
||||
|
||||
let cliSpace: Room | null = null;
|
||||
if (ModuleApi.extras.spacePanelItems.has(space)) {
|
||||
if (ModuleApi.instance.extras.spacePanelItems.has(space)) {
|
||||
// it's a "space" provided by a module: that's good enough
|
||||
} else if (!isMetaSpace(space)) {
|
||||
cliSpace = this.matrixClient.getRoom(space);
|
||||
@ -291,7 +291,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<EmptyObject> {
|
||||
context_switch: true,
|
||||
metricsTrigger: "WebSpaceContextSwitch",
|
||||
});
|
||||
} else if (ModuleApi.extras.spacePanelItems.has(space)) {
|
||||
} else if (ModuleApi.instance.extras.spacePanelItems.has(space)) {
|
||||
// module will handle this
|
||||
} else {
|
||||
defaultDispatcher.dispatch<ViewHomePagePayload>({
|
||||
@ -1214,7 +1214,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<EmptyObject> {
|
||||
const lastSpaceId = window.localStorage.getItem(ACTIVE_SPACE_LS_KEY) as MetaSpace;
|
||||
const valid =
|
||||
lastSpaceId &&
|
||||
(ModuleApi.extras.spacePanelItems.has(lastSpaceId) ||
|
||||
(ModuleApi.instance.extras.spacePanelItems.has(lastSpaceId) ||
|
||||
(!isMetaSpace(lastSpaceId) ? this.matrixClient.getRoom(lastSpaceId) : enabledMetaSpaces[lastSpaceId]));
|
||||
if (valid) {
|
||||
// don't context switch here as it may break permalinks
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user