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:
Kerry 2022-02-22 11:04:27 +01:00 committed by GitHub
parent 57595bc593
commit 5b8d440406
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 304 additions and 73 deletions

View file

@ -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",
}

View 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"];
}

View 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;
}

View 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;
}

View file

@ -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;
}

View 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;
}

View 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;
}

View 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"];
}