Skip to content

Commit c5ad2f0

Browse files
committed
[FIX] Correct download size calculation during installation process
1 parent 86ca1c6 commit c5ad2f0

File tree

1 file changed

+11
-3
lines changed
  • src/frontend/components/UI/DownloadToastManager

1 file changed

+11
-3
lines changed

src/frontend/components/UI/DownloadToastManager/index.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import DMQueueState from 'frontend/state/DMQueueState'
1414
import { isNotNative } from 'frontend/helpers/library'
1515
import { hasProgress } from 'frontend/hooks/hasProgress'
1616
import { useGameInfo } from 'frontend/hooks/useGameInfo'
17+
import { useEstimatedUncompressedSize } from 'frontend/hooks/useEstimatedUncompressedSize'
1718

1819
export default function DownloadToastManager() {
1920
const [latestElement, setLatestElement] = useState<DMQueueElement>()
@@ -37,6 +38,7 @@ export default function DownloadToastManager() {
3738
const installedPlatform = currentElement?.params.platformToInstall
3839
const isExtracting = status === 'extracting'
3940
const isPatching = status === 'patching'
41+
const isInstalling = status === 'installing'
4042
const { progress, etaInMs } = hasProgress(appName, isExtracting)
4143

4244
let showPlayTimeout: NodeJS.Timeout | undefined = undefined
@@ -160,10 +162,16 @@ export default function DownloadToastManager() {
160162
return 'inProgress'
161163
}
162164

165+
const uncompressedSize = useEstimatedUncompressedSize(
166+
platform,
167+
installInfo?.manifest?.disk_size || 0,
168+
installInfo?.manifest?.download_size || 0
169+
)
170+
163171
let adjustedDownloadedInBytes = downloadedMB * 1024 * 1024
164-
const adjustedDownloadSizeInBytes = isExtracting
165-
? installInfo?.manifest.disk_size || 0
166-
: installInfo?.manifest.download_size || 0
172+
const adjustedDownloadSizeInBytes = isInstalling
173+
? installInfo?.manifest.download_size || 0
174+
: uncompressedSize
167175

168176
if (isExtracting) {
169177
if (adjustedDownloadedInBytes > adjustedDownloadSizeInBytes) {

0 commit comments

Comments
 (0)