Merge matrix-react-sdk into element-web
Merge remote-tracking branch 'repomerge/t3chguy/repomerge' into t3chguy/repo-merge Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
commit
f0ee7f7905
3265 changed files with 484599 additions and 699 deletions
388
src/dispatcher/actions.ts
Normal file
388
src/dispatcher/actions.ts
Normal file
|
@ -0,0 +1,388 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
// Dispatcher actions also extend into any arbitrary string, so support that.
|
||||
export type DispatcherAction = Action | string;
|
||||
|
||||
export enum Action {
|
||||
// TODO: Populate with actual actions
|
||||
// This is lazily generated as it also includes fixing a bunch of references. Work
|
||||
// that we don't really want to take on in a giant chunk. We should always define
|
||||
// new actions here, and ideally when we touch existing ones we take some time to
|
||||
// define them correctly.
|
||||
|
||||
// When defining a new action, please use lower_scored_case with an optional class
|
||||
// name prefix. For example, `RoomListStore.view_room` or `view_user_settings`.
|
||||
// New definitions should also receive an accompanying interface in the payloads
|
||||
// directory.
|
||||
|
||||
/**
|
||||
* View a user's profile. Should be used with a ViewUserPayload.
|
||||
*/
|
||||
ViewUser = "view_user",
|
||||
|
||||
/**
|
||||
* Open the user settings. No additional payload information required.
|
||||
* Optionally can include an OpenToTabPayload.
|
||||
*/
|
||||
ViewUserSettings = "view_user_settings",
|
||||
|
||||
/**
|
||||
* Open the user device settings. No additional payload information required.
|
||||
*/
|
||||
ViewUserDeviceSettings = "view_user_device_settings",
|
||||
|
||||
/**
|
||||
* Opens the room directory. No additional payload information required.
|
||||
*/
|
||||
ViewRoomDirectory = "view_room_directory",
|
||||
|
||||
/**
|
||||
* Fires when viewing room by room_alias fails to find room
|
||||
*/
|
||||
ViewRoomError = "view_room_error",
|
||||
|
||||
/**
|
||||
* Navigates to app home
|
||||
*/
|
||||
ViewHomePage = "view_home_page",
|
||||
|
||||
/**
|
||||
* Forces the theme to reload. No additional payload information required.
|
||||
*/
|
||||
RecheckTheme = "recheck_theme",
|
||||
|
||||
/**
|
||||
* Provide status information for an ongoing update check. Should be used with a CheckUpdatesPayload.
|
||||
*/
|
||||
CheckUpdates = "check_updates",
|
||||
|
||||
/**
|
||||
* Focuses the user's cursor to the send message composer. Should be used with a FocusComposerPayload.
|
||||
*/
|
||||
FocusSendMessageComposer = "focus_send_message_composer",
|
||||
|
||||
/**
|
||||
* Clear the to the send message composer. Should be used with a FocusComposerPayload.
|
||||
*/
|
||||
ClearAndFocusSendMessageComposer = "clear_focus_send_message_composer",
|
||||
|
||||
/**
|
||||
* Focuses the user's cursor to the edit message composer. Should be used with a FocusComposerPayload.
|
||||
*/
|
||||
FocusEditMessageComposer = "focus_edit_message_composer",
|
||||
|
||||
/**
|
||||
* Focuses the user's cursor to the edit message composer or send message
|
||||
* composer based on the current edit state. Should be used with a FocusComposerPayload.
|
||||
*/
|
||||
FocusAComposer = "focus_a_composer",
|
||||
|
||||
/**
|
||||
* Focuses the threads panel.
|
||||
*/
|
||||
FocusThreadsPanel = "focus_threads_panel",
|
||||
|
||||
/**
|
||||
* Opens the user menu (previously known as the top left menu). No additional payload information required.
|
||||
*/
|
||||
ToggleUserMenu = "toggle_user_menu",
|
||||
|
||||
/**
|
||||
* Toggles the Space panel. No additional payload information required.
|
||||
*/
|
||||
ToggleSpacePanel = "toggle_space_panel",
|
||||
|
||||
/**
|
||||
* Sets the apps root font size. Should be used with UpdateFontSizePayload
|
||||
*/
|
||||
MigrateBaseFontSize = "migrate_base_font_size",
|
||||
|
||||
/**
|
||||
* Sets the apps root font size delta. Should be used with UpdateFontSizeDeltaPayload
|
||||
* It will add the delta to the current font size.
|
||||
* The delta should be between {@link FontWatcher.MIN_DELTA} and {@link FontWatcher.MAX_DELTA}.
|
||||
*/
|
||||
UpdateFontSizeDelta = "update_font_size_delta",
|
||||
|
||||
/**
|
||||
* Sets a system font. Should be used with UpdateSystemFontPayload
|
||||
*/
|
||||
UpdateSystemFont = "update_system_font",
|
||||
|
||||
/**
|
||||
* Changes room based on payload parameters. Should be used with JoinRoomPayload.
|
||||
*/
|
||||
ViewRoom = "view_room",
|
||||
|
||||
/**
|
||||
* Changes thread based on payload parameters. Should be used with ThreadPayload.
|
||||
*/
|
||||
ViewThread = "view_thread",
|
||||
|
||||
/**
|
||||
* Changes room based on room list order and payload parameters. Should be used with ViewRoomDeltaPayload.
|
||||
*/
|
||||
ViewRoomDelta = "view_room_delta",
|
||||
|
||||
/**
|
||||
* Opens the modal dial pad
|
||||
*/
|
||||
OpenDialPad = "open_dial_pad",
|
||||
|
||||
/**
|
||||
* Dial the phone number in the payload
|
||||
* payload: DialNumberPayload
|
||||
*/
|
||||
DialNumber = "dial_number",
|
||||
|
||||
/**
|
||||
* Fired when CallHandler has checked for PSTN protocol support
|
||||
* payload: none
|
||||
* XXX: Is an action the right thing for this?
|
||||
*/
|
||||
PstnSupportUpdated = "pstn_support_updated",
|
||||
|
||||
/**
|
||||
* Similar to PstnSupportUpdated, fired when CallHandler has checked for virtual room support
|
||||
* payload: none
|
||||
* XXX: Ditto
|
||||
*/
|
||||
VirtualRoomSupportUpdated = "virtual_room_support_updated",
|
||||
|
||||
/**
|
||||
* Fired when an upload has started. Should be used with UploadStartedPayload.
|
||||
*/
|
||||
UploadStarted = "upload_started",
|
||||
|
||||
/**
|
||||
* Fired when an upload makes progress. Should be used with UploadProgressPayload.
|
||||
*/
|
||||
UploadProgress = "upload_progress",
|
||||
|
||||
/**
|
||||
* Fired when an upload is completed. Should be used with UploadFinishedPayload.
|
||||
*/
|
||||
UploadFinished = "upload_finished",
|
||||
|
||||
/**
|
||||
* Fired when an upload fails. Should be used with UploadErrorPayload.
|
||||
*/
|
||||
UploadFailed = "upload_failed",
|
||||
|
||||
/**
|
||||
* Fired when an upload is cancelled by the user. Should be used with UploadCanceledPayload.
|
||||
*/
|
||||
UploadCanceled = "upload_canceled",
|
||||
|
||||
/**
|
||||
* Fired when requesting to join a room. Should be used with JoinRoomPayload.
|
||||
*/
|
||||
JoinRoom = "join_room",
|
||||
|
||||
/**
|
||||
* Fired when successfully joining a room. Should be used with a JoinRoomReadyPayload.
|
||||
*/
|
||||
JoinRoomReady = "join_room_ready",
|
||||
|
||||
/**
|
||||
* Fired when joining a room failed
|
||||
*/
|
||||
JoinRoomError = "join_room_error",
|
||||
|
||||
/**
|
||||
* Fired when starting to bulk redact messages from a user in a room.
|
||||
*/
|
||||
BulkRedactStart = "bulk_redact_start",
|
||||
|
||||
/**
|
||||
* Fired when done bulk redacting messages from a user in a room.
|
||||
*/
|
||||
BulkRedactEnd = "bulk_redact_end",
|
||||
|
||||
/**
|
||||
* Inserts content into the active composer. Should be used with ComposerInsertPayload.
|
||||
*/
|
||||
ComposerInsert = "composer_insert",
|
||||
|
||||
/**
|
||||
* Switches space. Should be used with SwitchSpacePayload.
|
||||
*/
|
||||
SwitchSpace = "switch_space",
|
||||
|
||||
/**
|
||||
* Signals to the visible space hierarchy that a change has occurred and that it should refresh.
|
||||
*/
|
||||
UpdateSpaceHierarchy = "update_space_hierarchy",
|
||||
|
||||
/**
|
||||
* Fires when a monitored setting is updated,
|
||||
* see SettingsStore::monitorSetting for more details.
|
||||
* Should be used with SettingUpdatedPayload.
|
||||
*/
|
||||
SettingUpdated = "setting_updated",
|
||||
|
||||
/**
|
||||
* Fires when a user starts to edit event (e.g. up arrow in compositor)
|
||||
*/
|
||||
EditEvent = "edit_event",
|
||||
|
||||
/**
|
||||
* The user accepted pseudonymous analytics (i.e. posthog) from the toast
|
||||
* Payload: none
|
||||
*/
|
||||
PseudonymousAnalyticsAccept = "pseudonymous_analytics_accept",
|
||||
|
||||
/**
|
||||
* The user rejected pseudonymous analytics (i.e. posthog) from the toast
|
||||
* Payload: none
|
||||
*/
|
||||
PseudonymousAnalyticsReject = "pseudonymous_analytics_reject",
|
||||
|
||||
/**
|
||||
* Fires after crypto is setup if key backup is not enabled
|
||||
* Used to trigger auto rageshakes when configured
|
||||
*/
|
||||
ReportKeyBackupNotEnabled = "report_key_backup_not_enabled",
|
||||
|
||||
/**
|
||||
* Dispatched after leave room or space is finished
|
||||
*/
|
||||
AfterLeaveRoom = "after_leave_room",
|
||||
|
||||
/**
|
||||
* Used to defer actions until after sync is complete
|
||||
* LifecycleStore will emit deferredAction payload after 'MatrixActions.sync'
|
||||
*/
|
||||
DoAfterSyncPrepared = "do_after_sync_prepared",
|
||||
|
||||
/**
|
||||
* Fired when clicking user name from group view
|
||||
*/
|
||||
ViewStartChatOrReuse = "view_start_chat_or_reuse",
|
||||
|
||||
/**
|
||||
* Fired when the user's active room changed, possibly from/to a non-room view.
|
||||
* Payload: ActiveRoomChangedPayload
|
||||
*/
|
||||
ActiveRoomChanged = "active_room_changed",
|
||||
|
||||
/**
|
||||
* Fired when the forward dialog needs to be opened.
|
||||
* Payload: OpenForwardDialogPayload
|
||||
*/
|
||||
OpenForwardDialog = "open_forward_dialog",
|
||||
|
||||
/**
|
||||
* Fired when the "report event" dialog needs to be opened.
|
||||
* Payload: OpenReportEventDialogPayload.
|
||||
*/
|
||||
OpenReportEventDialog = "open_report_event_dialog",
|
||||
|
||||
/**
|
||||
* Fired when something within the application has determined that a logout,
|
||||
* or logout-like behaviour, needs to happen. Specifically meant to target
|
||||
* storage deletion rather than calling the logout API.
|
||||
*
|
||||
* No payload.
|
||||
*/
|
||||
TriggerLogout = "trigger_logout",
|
||||
|
||||
/**
|
||||
* Opens the user's preferences for the given space. Used with a OpenSpacePreferencesPayload.
|
||||
*/
|
||||
OpenSpacePreferences = "open_space_preferences",
|
||||
|
||||
/**
|
||||
* Opens the settings for the given space. Used with a OpenSpaceSettingsPayload.
|
||||
*/
|
||||
OpenSpaceSettings = "open_space_settings",
|
||||
|
||||
/**
|
||||
* Opens the invite dialog. Used with a OpenInviteDialogPayload.
|
||||
*/
|
||||
OpenInviteDialog = "open_invite_dialog",
|
||||
|
||||
/**
|
||||
* Opens a dialog to add an existing object to a space. Used with a OpenAddExistingToSpaceDialogPayload.
|
||||
*/
|
||||
OpenAddToExistingSpaceDialog = "open_add_to_existing_space_dialog",
|
||||
|
||||
/**
|
||||
* Let components know that they should log any useful debugging information
|
||||
* because we're probably about to send bug report which includes all of the
|
||||
* logs. Fires with no payload.
|
||||
*/
|
||||
DumpDebugLogs = "dump_debug_logs",
|
||||
|
||||
/**
|
||||
* Show current room topic
|
||||
*/
|
||||
ShowRoomTopic = "show_room_topic",
|
||||
|
||||
/**
|
||||
* Fired when the client was logged out. No additional payload information required.
|
||||
*/
|
||||
OnLoggedOut = "on_logged_out",
|
||||
|
||||
/**
|
||||
* Fired when the client was logged in. No additional payload information required.
|
||||
*/
|
||||
OnLoggedIn = "on_logged_in",
|
||||
|
||||
/**
|
||||
* Overwrites the existing login with fresh session credentials. Use with a OverwriteLoginPayload.
|
||||
*/
|
||||
OverwriteLogin = "overwrite_login",
|
||||
|
||||
/**
|
||||
* Fired when the PlatformPeg gets a new platform set upon it, should only happen once per app load lifecycle.
|
||||
* Fires with the PlatformSetPayload.
|
||||
*/
|
||||
PlatformSet = "platform_set",
|
||||
|
||||
/**
|
||||
* Fired when we want to view a thread, either a new one or an existing one
|
||||
*/
|
||||
ShowThread = "show_thread",
|
||||
|
||||
/**
|
||||
* Fired when requesting to prompt for ask to join a room.
|
||||
*/
|
||||
PromptAskToJoin = "prompt_ask_to_join",
|
||||
|
||||
/**
|
||||
* Fired when requesting to submit an ask to join a room. Use with a SubmitAskToJoinPayload.
|
||||
*/
|
||||
SubmitAskToJoin = "submit_ask_to_join",
|
||||
|
||||
/**
|
||||
* Fired when requesting to cancel an ask to join a room. Use with a CancelAskToJoinPayload.
|
||||
*/
|
||||
CancelAskToJoin = "cancel_ask_to_join",
|
||||
|
||||
/**
|
||||
* Fired when we want to open spotlight search. Use with a OpenSpotlightPayload.
|
||||
*/
|
||||
OpenSpotlight = "open_spotlight",
|
||||
|
||||
/**
|
||||
* Fired when the room loaded.
|
||||
*/
|
||||
RoomLoaded = "room_loaded",
|
||||
|
||||
/**
|
||||
* Opens right panel with 3pid invite information
|
||||
*/
|
||||
View3pidInvite = "view_3pid_invite",
|
||||
|
||||
/**
|
||||
* Opens right panel room summary and focuses the search input
|
||||
*/
|
||||
FocusMessageSearch = "focus_search",
|
||||
}
|
184
src/dispatcher/dispatcher.ts
Normal file
184
src/dispatcher/dispatcher.ts
Normal file
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
Copyright 2017 New Vector Ltd
|
||||
Copyright 2015, 2016 OpenMarket Ltd
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Action } from "./actions";
|
||||
import { ActionPayload, AsyncActionPayload } from "./payloads";
|
||||
|
||||
type DispatchToken = string;
|
||||
|
||||
function invariant(cond: any, error: string): void {
|
||||
if (!cond) throw new Error(error);
|
||||
}
|
||||
|
||||
/**
|
||||
* A dispatcher for ActionPayloads (the default within the SDK).
|
||||
* Based on the old Flux dispatcher https://github.com/facebook/flux/blob/main/src/Dispatcher.js
|
||||
*/
|
||||
export class MatrixDispatcher {
|
||||
private readonly callbacks = new Map<DispatchToken, (payload: ActionPayload) => void>();
|
||||
private readonly isHandled = new Map<DispatchToken, boolean>();
|
||||
private readonly isPending = new Map<DispatchToken, boolean>();
|
||||
private pendingPayload?: ActionPayload;
|
||||
private lastId = 1;
|
||||
|
||||
/**
|
||||
* Registers a callback to be invoked with every dispatched payload. Returns
|
||||
* a token that can be used with `waitFor()`.
|
||||
*/
|
||||
public register(callback: (payload: ActionPayload) => void): DispatchToken {
|
||||
const id = "ID_" + this.lastId++;
|
||||
this.callbacks.set(id, callback);
|
||||
if (this.isDispatching()) {
|
||||
// If there is a dispatch happening right now then the newly registered callback should be skipped
|
||||
this.isPending.set(id, true);
|
||||
this.isHandled.set(id, true);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a callback based on its token.
|
||||
*/
|
||||
public unregister(id: DispatchToken): void {
|
||||
invariant(this.callbacks.has(id), `Dispatcher.unregister(...): '${id}' does not map to a registered callback.`);
|
||||
this.callbacks.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for the callbacks specified to be invoked before continuing execution
|
||||
* of the current callback. This method should only be used by a callback in
|
||||
* response to a dispatched payload.
|
||||
*/
|
||||
public waitFor(ids: DispatchToken[]): void {
|
||||
invariant(this.isDispatching(), "Dispatcher.waitFor(...): Must be invoked while dispatching.");
|
||||
for (const id of ids) {
|
||||
if (this.isPending.get(id)) {
|
||||
invariant(
|
||||
this.isHandled.get(id),
|
||||
`Dispatcher.waitFor(...): Circular dependency detected while waiting for '${id}'.`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
invariant(
|
||||
this.callbacks.get(id),
|
||||
`Dispatcher.waitFor(...): '${id}' does not map to a registered callback.`,
|
||||
);
|
||||
this.invokeCallback(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches a payload to all registered callbacks.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
private _dispatch = (payload: ActionPayload): void => {
|
||||
invariant(!this.isDispatching(), "Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.");
|
||||
this.startDispatching(payload);
|
||||
try {
|
||||
for (const [id] of this.callbacks) {
|
||||
if (this.isPending.get(id)) {
|
||||
continue;
|
||||
}
|
||||
this.invokeCallback(id);
|
||||
}
|
||||
} finally {
|
||||
this.stopDispatching();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Is this Dispatcher currently dispatching.
|
||||
*/
|
||||
public isDispatching(): boolean {
|
||||
return !!this.pendingPayload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the callback stored with the given id. Also do some internal
|
||||
* bookkeeping.
|
||||
*
|
||||
* Must only be called with an id which has a callback and pendingPayload set
|
||||
* @internal
|
||||
*/
|
||||
private invokeCallback(id: DispatchToken): void {
|
||||
this.isPending.set(id, true);
|
||||
this.callbacks.get(id)!(this.pendingPayload!);
|
||||
this.isHandled.set(id, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up bookkeeping needed when dispatching.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
private startDispatching(payload: ActionPayload): void {
|
||||
for (const [id] of this.callbacks) {
|
||||
this.isPending.set(id, false);
|
||||
this.isHandled.set(id, false);
|
||||
}
|
||||
this.pendingPayload = payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear bookkeeping used for dispatching.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
private stopDispatching(): void {
|
||||
this.pendingPayload = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches an event on the dispatcher's event bus.
|
||||
* @param {ActionPayload} payload Required. The payload to dispatch.
|
||||
* @param {boolean=false} sync Optional. Pass true to dispatch
|
||||
* synchronously. This is useful for anything triggering
|
||||
* an operation that the browser requires user interaction
|
||||
* for. Default false (async).
|
||||
*/
|
||||
public dispatch<T extends ActionPayload>(payload: T, sync = false): void {
|
||||
if (payload instanceof AsyncActionPayload) {
|
||||
payload.fn((action: ActionPayload) => {
|
||||
this.dispatch(action, sync);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (sync) {
|
||||
this._dispatch(payload);
|
||||
} else {
|
||||
// Unless the caller explicitly asked for us to dispatch synchronously,
|
||||
// we always set a timeout to do this: The flux dispatcher complains
|
||||
// if you dispatch from within a dispatch, so rather than action
|
||||
// handlers having to worry about not calling anything that might
|
||||
// then dispatch, we just do dispatches asynchronously.
|
||||
window.setTimeout(this._dispatch, 0, payload);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shorthand for dispatch({action: Action.WHATEVER}, sync). No additional
|
||||
* properties can be included with this version.
|
||||
* @param {Action} action The action to dispatch.
|
||||
* @param {boolean=false} sync Whether the dispatch should be sync or not.
|
||||
* @see dispatch(action: ActionPayload, sync: boolean)
|
||||
*/
|
||||
public fire(action: Action, sync = false): void {
|
||||
this.dispatch({ action }, sync);
|
||||
}
|
||||
}
|
||||
|
||||
export const defaultDispatcher = new MatrixDispatcher();
|
||||
|
||||
if (!window.mxDispatcher) {
|
||||
window.mxDispatcher = defaultDispatcher;
|
||||
}
|
||||
|
||||
export default defaultDispatcher;
|
51
src/dispatcher/payloads.ts
Normal file
51
src/dispatcher/payloads.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { DispatcherAction } from "./actions";
|
||||
|
||||
/**
|
||||
* The base dispatch type exposed by our dispatcher.
|
||||
*/
|
||||
export interface ActionPayload {
|
||||
[property: string]: any; // effectively makes this 'extends Object'
|
||||
action: DispatcherAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* The function the dispatcher calls when ready for an AsyncActionPayload. The
|
||||
* single argument is used to start a dispatch. First the dispatcher calls the
|
||||
* outer function, then when the called function is ready it calls the cb
|
||||
* function to issue the dispatch. It may call the callback repeatedly if needed.
|
||||
*/
|
||||
export type AsyncActionFn = (cb: (action: ActionPayload) => void) => void;
|
||||
|
||||
/**
|
||||
* An async version of ActionPayload
|
||||
*/
|
||||
export class AsyncActionPayload implements ActionPayload {
|
||||
/**
|
||||
* The function the dispatcher should call.
|
||||
*/
|
||||
public readonly fn: AsyncActionFn;
|
||||
|
||||
/**
|
||||
* @deprecated Not used on AsyncActionPayload.
|
||||
*/
|
||||
public get action(): DispatcherAction {
|
||||
return "NOT_USED";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new AsyncActionPayload with the given ready function.
|
||||
* @param {AsyncActionFn} readyFn The function to be called when the
|
||||
* dispatcher is ready.
|
||||
*/
|
||||
public constructor(readyFn: AsyncActionFn) {
|
||||
this.fn = readyFn;
|
||||
}
|
||||
}
|
19
src/dispatcher/payloads/ActiveRoomChangedPayload.ts
Normal file
19
src/dispatcher/payloads/ActiveRoomChangedPayload.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Optional } from "matrix-events-sdk";
|
||||
|
||||
import { Action } from "../actions";
|
||||
import { ActionPayload } from "../payloads";
|
||||
|
||||
export interface ActiveRoomChangedPayload extends ActionPayload {
|
||||
action: Action.ActiveRoomChanged;
|
||||
|
||||
oldRoomId: Optional<string>;
|
||||
newRoomId: Optional<string>;
|
||||
}
|
18
src/dispatcher/payloads/AfterLeaveRoomPayload.ts
Normal file
18
src/dispatcher/payloads/AfterLeaveRoomPayload.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Room } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { Action } from "../actions";
|
||||
import { ActionPayload } from "../payloads";
|
||||
|
||||
export interface AfterLeaveRoomPayload extends ActionPayload {
|
||||
action: Action.AfterLeaveRoom;
|
||||
// eslint-disable-next-line camelcase
|
||||
room_id?: Room["roomId"];
|
||||
}
|
16
src/dispatcher/payloads/CancelAskToJoinPayload.ts
Normal file
16
src/dispatcher/payloads/CancelAskToJoinPayload.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 Nordeck IT + Consulting GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Action } from "../actions";
|
||||
import { ActionPayload } from "../payloads";
|
||||
|
||||
export interface CancelAskToJoinPayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.CancelAskToJoin;
|
||||
|
||||
roomId: string;
|
||||
}
|
15
src/dispatcher/payloads/CheckUpdatesPayload.ts
Normal file
15
src/dispatcher/payloads/CheckUpdatesPayload.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
import { UpdateStatus } from "../../BasePlatform";
|
||||
|
||||
export interface CheckUpdatesPayload extends ActionPayload, UpdateStatus {
|
||||
action: Action.CheckUpdates;
|
||||
}
|
32
src/dispatcher/payloads/ComposerInsertPayload.ts
Normal file
32
src/dispatcher/payloads/ComposerInsertPayload.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
import { TimelineRenderingType } from "../../contexts/RoomContext";
|
||||
|
||||
export enum ComposerType {
|
||||
Send = "send",
|
||||
Edit = "edit",
|
||||
}
|
||||
|
||||
interface IBaseComposerInsertPayload extends ActionPayload {
|
||||
action: Action.ComposerInsert;
|
||||
timelineRenderingType: TimelineRenderingType;
|
||||
composerType?: ComposerType; // falsy if should be re-dispatched to the correct composer
|
||||
}
|
||||
|
||||
interface IComposerInsertMentionPayload extends IBaseComposerInsertPayload {
|
||||
userId: string;
|
||||
}
|
||||
|
||||
interface IComposerInsertPlaintextPayload extends IBaseComposerInsertPayload {
|
||||
text: string;
|
||||
}
|
||||
|
||||
export type ComposerInsertPayload = IComposerInsertMentionPayload | IComposerInsertPlaintextPayload;
|
16
src/dispatcher/payloads/DoAfterSyncPreparedPayload.ts
Normal file
16
src/dispatcher/payloads/DoAfterSyncPreparedPayload.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface DoAfterSyncPreparedPayload<T extends ActionPayload> extends Pick<ActionPayload, "action"> {
|
||||
action: Action.DoAfterSyncPrepared;
|
||||
// eslint-disable-next-line camelcase
|
||||
deferred_action: T;
|
||||
}
|
21
src/dispatcher/payloads/FocusComposerPayload.ts
Normal file
21
src/dispatcher/payloads/FocusComposerPayload.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
import { TimelineRenderingType } from "../../contexts/RoomContext";
|
||||
|
||||
export interface FocusComposerPayload extends ActionPayload {
|
||||
action:
|
||||
| Action.FocusAComposer
|
||||
| Action.FocusEditMessageComposer
|
||||
| Action.FocusSendMessageComposer
|
||||
| "reply_to_event";
|
||||
|
||||
context?: TimelineRenderingType; // defaults to Room type for backwards compatibility
|
||||
}
|
21
src/dispatcher/payloads/JoinRoomErrorPayload.ts
Normal file
21
src/dispatcher/payloads/JoinRoomErrorPayload.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { MatrixError } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface JoinRoomErrorPayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.JoinRoomError;
|
||||
|
||||
roomId: string;
|
||||
err: MatrixError;
|
||||
|
||||
canAskToJoin?: boolean;
|
||||
}
|
27
src/dispatcher/payloads/JoinRoomPayload.ts
Normal file
27
src/dispatcher/payloads/JoinRoomPayload.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { JoinedRoom as JoinedRoomEvent } from "@matrix-org/analytics-events/types/typescript/JoinedRoom";
|
||||
import { IJoinRoomOpts } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
export interface JoinRoomPayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.JoinRoom;
|
||||
|
||||
roomId: string;
|
||||
opts?: IJoinRoomOpts;
|
||||
|
||||
// additional parameters for the purpose of metrics & instrumentation
|
||||
metricsTrigger: JoinedRoomEvent["trigger"];
|
||||
|
||||
canAskToJoin?: boolean;
|
||||
}
|
||||
/* eslint-enable camelcase */
|
22
src/dispatcher/payloads/JoinRoomReadyPayload.ts
Normal file
22
src/dispatcher/payloads/JoinRoomReadyPayload.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { JoinedRoom as JoinedRoomEvent } from "@matrix-org/analytics-events/types/typescript/JoinedRoom";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
export interface JoinRoomReadyPayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.JoinRoomReady;
|
||||
roomId: string;
|
||||
|
||||
// additional parameters for the purpose of metrics & instrumentation
|
||||
metricsTrigger: JoinedRoomEvent["trigger"];
|
||||
}
|
||||
/* eslint-enable camelcase */
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Room } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface OpenAddExistingToSpaceDialogPayload extends ActionPayload {
|
||||
action: Action.OpenAddToExistingSpaceDialog;
|
||||
|
||||
space: Room;
|
||||
}
|
21
src/dispatcher/payloads/OpenForwardDialogPayload.ts
Normal file
21
src/dispatcher/payloads/OpenForwardDialogPayload.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { Optional } from "matrix-events-sdk";
|
||||
|
||||
import { Action } from "../actions";
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { RoomPermalinkCreator } from "../../utils/permalinks/Permalinks";
|
||||
|
||||
export interface OpenForwardDialogPayload extends ActionPayload {
|
||||
action: Action.OpenForwardDialog;
|
||||
|
||||
event: MatrixEvent;
|
||||
permalinkCreator: Optional<RoomPermalinkCreator>;
|
||||
}
|
27
src/dispatcher/payloads/OpenInviteDialogPayload.ts
Normal file
27
src/dispatcher/payloads/OpenInviteDialogPayload.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Optional } from "matrix-events-sdk";
|
||||
import { MatrixCall } from "matrix-js-sdk/src/webrtc/call";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
import { InviteKind } from "../../components/views/dialogs/InviteDialogTypes";
|
||||
|
||||
export interface OpenInviteDialogPayload extends ActionPayload {
|
||||
action: Action.OpenInviteDialog;
|
||||
|
||||
kind: InviteKind;
|
||||
onFinishedCallback: Optional<(results: boolean[]) => void>;
|
||||
|
||||
call?: MatrixCall;
|
||||
roomId?: string;
|
||||
|
||||
analyticsName: string;
|
||||
className: string;
|
||||
}
|
18
src/dispatcher/payloads/OpenReportEventDialogPayload.ts
Normal file
18
src/dispatcher/payloads/OpenReportEventDialogPayload.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { Action } from "../actions";
|
||||
import { ActionPayload } from "../payloads";
|
||||
|
||||
export interface OpenReportEventDialogPayload extends ActionPayload {
|
||||
action: Action.OpenReportEventDialog;
|
||||
|
||||
event: MatrixEvent;
|
||||
}
|
30
src/dispatcher/payloads/OpenSpacePreferencesPayload.ts
Normal file
30
src/dispatcher/payloads/OpenSpacePreferencesPayload.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Room } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export enum SpacePreferenceTab {
|
||||
Appearance = "SPACE_PREFERENCE_APPEARANCE_TAB",
|
||||
}
|
||||
|
||||
export interface OpenSpacePreferencesPayload extends ActionPayload {
|
||||
action: Action.OpenSpacePreferences;
|
||||
|
||||
/**
|
||||
* The space to open preferences for.
|
||||
*/
|
||||
space: Room;
|
||||
|
||||
/**
|
||||
* Optional tab to open specifically, otherwise the dialog's internal default.
|
||||
*/
|
||||
initialTabId?: SpacePreferenceTab;
|
||||
}
|
21
src/dispatcher/payloads/OpenSpaceSettingsPayload.ts
Normal file
21
src/dispatcher/payloads/OpenSpaceSettingsPayload.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Room } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface OpenSpaceSettingsPayload extends ActionPayload {
|
||||
action: Action.OpenSpaceSettings;
|
||||
|
||||
/**
|
||||
* The space to open settings for.
|
||||
*/
|
||||
space: Room;
|
||||
}
|
18
src/dispatcher/payloads/OpenSpotlightPayload.ts
Normal file
18
src/dispatcher/payloads/OpenSpotlightPayload.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Action } from "../actions";
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Filter } from "../../components/views/dialogs/spotlight/Filter";
|
||||
|
||||
export interface OpenSpotlightPayload extends ActionPayload {
|
||||
action: Action.OpenSpotlight;
|
||||
|
||||
initialFilter?: Filter;
|
||||
initialText?: string;
|
||||
}
|
24
src/dispatcher/payloads/OpenToTabPayload.ts
Normal file
24
src/dispatcher/payloads/OpenToTabPayload.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface OpenToTabPayload extends ActionPayload {
|
||||
action: Action.ViewUserSettings | string; // TODO: Add room settings action
|
||||
|
||||
/**
|
||||
* The tab ID to open in the settings view to start, if possible.
|
||||
*/
|
||||
initialTabId?: string;
|
||||
|
||||
/**
|
||||
* Additional properties to pass to the settings view.
|
||||
*/
|
||||
props?: Record<string, any>;
|
||||
}
|
17
src/dispatcher/payloads/OverwriteLoginPayload.ts
Normal file
17
src/dispatcher/payloads/OverwriteLoginPayload.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
import { IMatrixClientCreds } from "../../MatrixClientPeg";
|
||||
|
||||
export interface OverwriteLoginPayload extends ActionPayload {
|
||||
action: Action.OverwriteLogin;
|
||||
|
||||
credentials: IMatrixClientCreds;
|
||||
}
|
16
src/dispatcher/payloads/PlatformSetPayload.ts
Normal file
16
src/dispatcher/payloads/PlatformSetPayload.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Action } from "../actions";
|
||||
import { ActionPayload } from "../payloads";
|
||||
import BasePlatform from "../../BasePlatform";
|
||||
|
||||
export interface PlatformSetPayload extends ActionPayload {
|
||||
action: Action.PlatformSet;
|
||||
platform: BasePlatform;
|
||||
}
|
19
src/dispatcher/payloads/RecheckThemePayload.ts
Normal file
19
src/dispatcher/payloads/RecheckThemePayload.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface RecheckThemePayload extends ActionPayload {
|
||||
action: Action.RecheckTheme;
|
||||
|
||||
/**
|
||||
* Optionally specify the exact theme which is to be loaded.
|
||||
*/
|
||||
forceTheme?: string;
|
||||
}
|
22
src/dispatcher/payloads/SettingUpdatedPayload.ts
Normal file
22
src/dispatcher/payloads/SettingUpdatedPayload.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
import { SettingLevel } from "../../settings/SettingLevel";
|
||||
import { SettingValueType } from "../../settings/Settings";
|
||||
|
||||
export interface SettingUpdatedPayload extends ActionPayload {
|
||||
action: Action.SettingUpdated;
|
||||
|
||||
settingName: string;
|
||||
roomId: string | null;
|
||||
level: SettingLevel;
|
||||
newValueAtLevel: SettingLevel;
|
||||
newValue: SettingValueType;
|
||||
}
|
22
src/dispatcher/payloads/ShowThreadPayload.ts
Normal file
22
src/dispatcher/payloads/ShowThreadPayload.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface ShowThreadPayload extends ActionPayload {
|
||||
action: Action.ShowThread;
|
||||
|
||||
rootEvent: MatrixEvent;
|
||||
initialEvent?: MatrixEvent;
|
||||
highlighted?: boolean;
|
||||
scrollIntoView?: boolean;
|
||||
push?: boolean;
|
||||
}
|
19
src/dispatcher/payloads/SubmitAskToJoinPayload.ts
Normal file
19
src/dispatcher/payloads/SubmitAskToJoinPayload.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 Nordeck IT + Consulting GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { KnockRoomOpts } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { Action } from "../actions";
|
||||
import { ActionPayload } from "../payloads";
|
||||
|
||||
export interface SubmitAskToJoinPayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.SubmitAskToJoin;
|
||||
|
||||
roomId: string;
|
||||
opts?: KnockRoomOpts;
|
||||
}
|
19
src/dispatcher/payloads/SwitchSpacePayload.ts
Normal file
19
src/dispatcher/payloads/SwitchSpacePayload.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface SwitchSpacePayload extends ActionPayload {
|
||||
action: Action.SwitchSpace;
|
||||
|
||||
/**
|
||||
* The number of the space to switch to, 1-indexed, 0 is Home.
|
||||
*/
|
||||
num: number;
|
||||
}
|
18
src/dispatcher/payloads/ThreadPayload.ts
Normal file
18
src/dispatcher/payloads/ThreadPayload.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
export interface ThreadPayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.ViewThread;
|
||||
|
||||
thread_id: string | null;
|
||||
}
|
||||
/* eslint-enable camelcase */
|
20
src/dispatcher/payloads/UpdateFontSizeDeltaPayload.ts
Normal file
20
src/dispatcher/payloads/UpdateFontSizeDeltaPayload.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface UpdateFontSizeDeltaPayload extends ActionPayload {
|
||||
action: Action.UpdateFontSizeDelta;
|
||||
|
||||
/**
|
||||
* The delta is added to the current font size.
|
||||
* The delta should be between {@link FontWatcher.MIN_DELTA} and {@link FontWatcher.MAX_DELTA}.
|
||||
*/
|
||||
delta: number;
|
||||
}
|
29
src/dispatcher/payloads/UpdateSystemFontPayload.ts
Normal file
29
src/dispatcher/payloads/UpdateSystemFontPayload.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface UpdateSystemFontPayload extends ActionPayload {
|
||||
action: Action.UpdateSystemFont;
|
||||
|
||||
/**
|
||||
* Specify whether to use the bundled emoji font or the system font
|
||||
*/
|
||||
useBundledEmojiFont: boolean;
|
||||
|
||||
/**
|
||||
* Specify whether to use a system font or the stylesheet font
|
||||
*/
|
||||
useSystemFont: boolean;
|
||||
|
||||
/**
|
||||
* The system font to use
|
||||
*/
|
||||
font: string;
|
||||
}
|
43
src/dispatcher/payloads/UploadPayload.ts
Normal file
43
src/dispatcher/payloads/UploadPayload.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
import { RoomUpload } from "../../models/RoomUpload";
|
||||
|
||||
export interface UploadPayload extends ActionPayload {
|
||||
/**
|
||||
* The upload with fields representing the new upload state.
|
||||
*/
|
||||
upload: RoomUpload;
|
||||
}
|
||||
|
||||
export interface UploadStartedPayload extends UploadPayload {
|
||||
action: Action.UploadStarted;
|
||||
}
|
||||
|
||||
export interface UploadProgressPayload extends UploadPayload {
|
||||
action: Action.UploadProgress;
|
||||
}
|
||||
|
||||
export interface UploadErrorPayload extends UploadPayload {
|
||||
action: Action.UploadFailed;
|
||||
|
||||
/**
|
||||
* An error to describe what went wrong with the upload.
|
||||
*/
|
||||
error: unknown;
|
||||
}
|
||||
|
||||
export interface UploadFinishedPayload extends UploadPayload {
|
||||
action: Action.UploadFinished;
|
||||
}
|
||||
|
||||
export interface UploadCanceledPayload extends UploadPayload {
|
||||
action: Action.UploadCanceled;
|
||||
}
|
17
src/dispatcher/payloads/ViewHomePagePayload.ts
Normal file
17
src/dispatcher/payloads/ViewHomePagePayload.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { Action } from "../actions";
|
||||
import { ActionPayload } from "../payloads";
|
||||
|
||||
export interface ViewHomePagePayload extends ActionPayload {
|
||||
action: Action.ViewHomePage;
|
||||
// eslint-disable-next-line camelcase
|
||||
context_switch?: boolean;
|
||||
justRegistered?: boolean;
|
||||
}
|
24
src/dispatcher/payloads/ViewRoomDeltaPayload.ts
Normal file
24
src/dispatcher/payloads/ViewRoomDeltaPayload.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface ViewRoomDeltaPayload extends ActionPayload {
|
||||
action: Action.ViewRoomDelta;
|
||||
|
||||
/**
|
||||
* The delta index of the room to view.
|
||||
*/
|
||||
delta: number;
|
||||
|
||||
/**
|
||||
* Optionally, whether or not to filter to unread (Bold/Grey/Red) rooms only. (Default: false)
|
||||
*/
|
||||
unread?: boolean;
|
||||
}
|
21
src/dispatcher/payloads/ViewRoomErrorPayload.ts
Normal file
21
src/dispatcher/payloads/ViewRoomErrorPayload.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { MatrixError, Room } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface ViewRoomErrorPayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.ViewRoomError;
|
||||
// eslint-disable-next-line camelcase
|
||||
room_id: Room["roomId"] | null;
|
||||
// eslint-disable-next-line camelcase
|
||||
room_alias?: string;
|
||||
err?: MatrixError;
|
||||
}
|
60
src/dispatcher/payloads/ViewRoomPayload.ts
Normal file
60
src/dispatcher/payloads/ViewRoomPayload.ts
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { ViewRoom as ViewRoomEvent } from "@matrix-org/analytics-events/types/typescript/ViewRoom";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
import { IOOBData, IThreepidInvite } from "../../stores/ThreepidInviteStore";
|
||||
import { IOpts } from "../../createRoom";
|
||||
import { JoinRoomPayload } from "./JoinRoomPayload";
|
||||
import { AtLeastOne } from "../../@types/common";
|
||||
|
||||
export type FocusNextType = "composer" | "threadsPanel" | undefined;
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
interface BaseViewRoomPayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.ViewRoom;
|
||||
|
||||
event_id?: string; // the event to ensure is in view if any
|
||||
highlighted?: boolean; // whether to highlight `event_id`
|
||||
scroll_into_view?: boolean; // whether to scroll `event_id` into view
|
||||
should_peek?: boolean; // whether we should peek the room if we are not yet joined
|
||||
joining?: boolean; // whether we have already sent a join request for this room
|
||||
via_servers?: string[]; // the list of servers to join via if no room_alias is provided
|
||||
context_switch?: boolean; // whether this view room was a consequence of switching spaces
|
||||
replyingToEvent?: MatrixEvent; // the event we are replying to in this room if any
|
||||
auto_join?: boolean; // whether to automatically join the room if we are not already
|
||||
threepid_invite?: IThreepidInvite; // details about any 3pid invite we have to this room
|
||||
justCreatedOpts?: IOpts; // if this is a newly created room then this is a reference to the creation opts
|
||||
oob_data?: IOOBData; // any out-of-band data about this room can be used to render some room details without peeking
|
||||
forceTimeline?: boolean; // Whether to override default behaviour to end up at a timeline
|
||||
show_room_tile?: boolean; // Whether to ensure that the room tile is visible in the room list
|
||||
clear_search?: boolean; // Whether to clear the room list search
|
||||
view_call?: boolean; // Whether to view the call or call lobby for the room
|
||||
skipLobby?: boolean; // Whether to skip the call lobby when showing the call (only supported for element calls)
|
||||
opts?: JoinRoomPayload["opts"];
|
||||
|
||||
deferred_action?: ActionPayload; // Action to fire after MatrixChat handles this ViewRoom action
|
||||
|
||||
// additional parameters for the purpose of metrics & instrumentation
|
||||
metricsTrigger: ViewRoomEvent["trigger"];
|
||||
metricsViaKeyboard?: ViewRoomEvent["viaKeyboard"];
|
||||
}
|
||||
|
||||
export type ViewRoomPayload = BaseViewRoomPayload &
|
||||
AtLeastOne<{
|
||||
// either or both of room_id or room_alias must be specified
|
||||
// where possible, a room_id should be provided with a room_alias as it reduces
|
||||
// the number of API calls required.
|
||||
room_id?: string;
|
||||
room_alias?: string;
|
||||
focusNext: FocusNextType; // wat to focus after room switch. Defaults to 'composer' if undefined.
|
||||
}>;
|
||||
/* eslint-enable camelcase */
|
18
src/dispatcher/payloads/ViewStartChatOrReusePayload.ts
Normal file
18
src/dispatcher/payloads/ViewStartChatOrReusePayload.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { User } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface ViewStartChatOrReusePayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.ViewStartChatOrReuse;
|
||||
// eslint-disable-next-line camelcase
|
||||
user_id: User["userId"];
|
||||
}
|
22
src/dispatcher/payloads/ViewUserPayload.ts
Normal file
22
src/dispatcher/payloads/ViewUserPayload.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { RoomMember, User } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface ViewUserPayload extends ActionPayload {
|
||||
action: Action.ViewUser;
|
||||
|
||||
/**
|
||||
* The member to view. May be null or falsy to indicate that no member
|
||||
* should be shown (hide whichever relevant components).
|
||||
*/
|
||||
member?: RoomMember | User;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue