Skip to content

Commit

Permalink
remove unnecessary type
Browse files Browse the repository at this point in the history
  • Loading branch information
wildan-m committed May 10, 2024
1 parent 6c5d186 commit 99d3e04
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 64 deletions.
2 changes: 1 addition & 1 deletion desktop/createDownloadQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';
import createQueue from '@libs/Queue/Queue';
import CONST from '@src/CONST';
import ELECTRON_EVENTS from './ELECTRON_EVENTS';
import type {Options} from './electronDownloadManagerType';
import type Options from './electronDownloadManagerType';

type DownloadItem = {
// The window where the download will be initiated
Expand Down
64 changes: 2 additions & 62 deletions desktop/electronDownloadManagerType.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
import type {DownloadItem, SaveDialogOptions} from 'electron';
import type {SaveDialogOptions} from 'electron';

type File = {
// The name of the file being downloaded
filename: string;

// The path where the file is being downloaded to
path: string;

// The size of the file being downloaded, in bytes
fileSize: number;

// The MIME type of the file being downloaded
mimeType: string;

// The URL of the file being downloaded
url: string;
};
type Options = {
/**
Show a `Save As…` dialog instead of downloading immediately.
Expand Down Expand Up @@ -43,47 +27,6 @@ type Options = {
*/
readonly filename?: string;

/**
Title of the error dialog. Can be customized for localization.
Note: Error dialog will not be shown in `electronDownloadManager.download()`. Please handle error manually.
@default 'Download Error'
*/
readonly errorTitle?: string;

/**
Message of the error dialog. `{filename}` is replaced with the name of the actual file. Can be customized for localization.
Note: Error dialog will not be shown in `electronDownloadManager.download()`. Please handle error manually.
@default 'The download of {filename} was interrupted'
*/
readonly errorMessage?: string;

/**
Optional callback that receives the [download item](https://electronjs.org/docs/api/download-item).
You can use this for advanced handling such as canceling the item like `item.cancel()`.
*/
readonly onStarted?: (item: DownloadItem) => void;

/**
Optional callback that receives the [download item](https://electronjs.org/docs/api/download-item) for which the download has been cancelled.
*/
readonly onCancel?: (item: DownloadItem) => void;

/**
Optional callback that receives an object with information about an item that has been completed. It is called for each completed item.
*/
readonly onCompleted?: (file: File) => void;

/**
Reveal the downloaded file in the system file manager, and if possible, select the file.
@default false
*/
readonly openFolderWhenDone?: boolean;

/**
Allow downloaded files to overwrite files with the same name in the directory they are saved to.
Expand All @@ -101,9 +44,6 @@ type Options = {
@default {}
*/
readonly dialogOptions?: SaveDialogOptions;

/** Unregister the listener when the download is done. */
readonly unregisterWhenDone?: boolean;
};

export type {Options, File};
export default Options;
2 changes: 1 addition & 1 deletion src/libs/fileDownload/index.desktop.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ELECTRON_EVENTS from '@desktop/ELECTRON_EVENTS';
import type {Options} from '@desktop/electronDownloadManagerType';
import type Options from '@desktop/electronDownloadManagerType';
import CONST from '@src/CONST';
import type {FileDownload} from './types';

Expand Down

0 comments on commit 99d3e04

Please sign in to comment.