type Actions (#7862)
* type ViewHomPage action Signed-off-by: Kerry Archibald <kerrya@element.io> * type spacestore actions Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * add action types Signed-off-by: Kerry Archibald <kerrya@element.io> * use new action types in stores Signed-off-by: Kerry Archibald <kerrya@element.io> * remove debug change Signed-off-by: Kerry Archibald <kerrya@element.io> * stricter keyboard shortcut types Signed-off-by: Kerry Archibald <kerrya@element.io> * action comments Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
57595bc593
commit
5b8d440406
33 changed files with 304 additions and 73 deletions
|
@ -45,6 +45,16 @@ export enum Action {
|
|||
*/
|
||||
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.
|
||||
*/
|
||||
|
@ -224,4 +234,20 @@ export enum Action {
|
|||
* 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",
|
||||
}
|
||||
|
|
26
src/dispatcher/payloads/AfterLeaveRoomPayload.ts
Normal file
26
src/dispatcher/payloads/AfterLeaveRoomPayload.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
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";
|
||||
|
||||
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"];
|
||||
}
|
24
src/dispatcher/payloads/DoAfterSyncPreparedPayload.ts
Normal file
24
src/dispatcher/payloads/DoAfterSyncPreparedPayload.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
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 { 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;
|
||||
}
|
27
src/dispatcher/payloads/JoinRoomErrorPayload.ts
Normal file
27
src/dispatcher/payloads/JoinRoomErrorPayload.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
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 { MatrixError } from "matrix-js-sdk";
|
||||
|
||||
import { ActionPayload } from "../payloads";
|
||||
import { Action } from "../actions";
|
||||
|
||||
export interface JoinRoomErrorPayload extends Pick<ActionPayload, "action"> {
|
||||
action: Action.JoinRoomError;
|
||||
|
||||
roomId: string;
|
||||
err?: MatrixError;
|
||||
}
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
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;
|
||||
|
@ -25,5 +26,5 @@ export interface SettingUpdatedPayload extends ActionPayload {
|
|||
roomId: string;
|
||||
level: SettingLevel;
|
||||
newValueAtLevel: SettingLevel;
|
||||
newValue: any;
|
||||
newValue: SettingValueType;
|
||||
}
|
||||
|
|
25
src/dispatcher/payloads/ViewHomePagePayload.ts
Normal file
25
src/dispatcher/payloads/ViewHomePagePayload.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
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 { 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;
|
||||
}
|
29
src/dispatcher/payloads/ViewRoomErrorPayload.ts
Normal file
29
src/dispatcher/payloads/ViewRoomErrorPayload.ts
Normal file
|
@ -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 { MatrixError, Room } from "matrix-js-sdk";
|
||||
|
||||
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"];
|
||||
// eslint-disable-next-line camelcase
|
||||
room_alias?: string;
|
||||
err?: MatrixError;
|
||||
}
|
26
src/dispatcher/payloads/ViewStartChatOrReusePayload.ts
Normal file
26
src/dispatcher/payloads/ViewStartChatOrReusePayload.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
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 { User } from "matrix-js-sdk";
|
||||
|
||||
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"];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue