Convert all of file uploads to the new dispatcher
This commit is contained in:
parent
ae9618367e
commit
bb80cfb9a6
6 changed files with 123 additions and 22 deletions
|
@ -113,4 +113,29 @@ export enum Action {
|
|||
* 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",
|
||||
}
|
||||
|
|
51
src/dispatcher/payloads/UploadPayload.ts
Normal file
51
src/dispatcher/payloads/UploadPayload.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright 2021 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";
|
||||
import {IUpload} from "../../models/IUpload";
|
||||
|
||||
interface UploadPayload extends ActionPayload {
|
||||
/**
|
||||
* The upload with fields representing the new upload state.
|
||||
*/
|
||||
upload: IUpload;
|
||||
}
|
||||
|
||||
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: Error;
|
||||
}
|
||||
|
||||
export interface UploadFinishedPayload extends UploadPayload {
|
||||
action: Action.UploadFinished;
|
||||
}
|
||||
|
||||
export interface UploadCanceledPayload extends UploadPayload {
|
||||
action: Action.UploadCanceled;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue