diff --git a/src/services/libs/formatBytes.ts b/src/services/libs/formatBytes.ts index 4d9568e0..a903c5c8 100644 --- a/src/services/libs/formatBytes.ts +++ b/src/services/libs/formatBytes.ts @@ -1,4 +1,5 @@ /** + * Used to be in updater to show download progress. * https://stackoverflow.com/a/18650828 */ export default function formatBytes(bytes: number, decimals = 2): string { diff --git a/src/services/updater/hooks.ts b/src/services/updater/hooks.ts index cb02dce5..dec7b975 100644 --- a/src/services/updater/hooks.ts +++ b/src/services/updater/hooks.ts @@ -1,7 +1,6 @@ import { useState } from 'react'; import { useObservable } from 'beautiful-react-hooks'; -import formatBytes from '@services/libs/formatBytes'; import { IUpdaterMetaData } from './interface'; export function useUpdaterObservable(): IUpdaterMetaData | undefined { @@ -9,27 +8,3 @@ export function useUpdaterObservable(): IUpdaterMetaData | undefined { useObservable(window.observables.updater.updaterMetaData$, updaterMetaDataSetter as any); return updaterMetaData; } - -export function getUpdaterDesc(status: IUpdaterMetaData['status'], info: IUpdaterMetaData['info']): string { - if (info instanceof Error) { - return info.message; - } - if (status === 'download-progress') { - if (info !== undefined && 'transferred' in info) { - const { transferred, total, bytesPerSecond } = info; - return `Downloading updates (${formatBytes(transferred)}/${formatBytes(total)} at ${formatBytes(bytesPerSecond)}/s)...`; - } - return 'Downloading updates...'; - } - if (status === 'checking-for-update') { - return 'Checking for updates...'; - } - if (status === 'update-available') { - return 'Downloading updates...'; - } - if (status === 'update-downloaded') { - if (info !== undefined && 'version' in info) return `A new version (${info.version}) has been downloaded.`; - return 'A new version has been downloaded.'; - } - return ''; -}