Skip to content

Comments

fix(filesystem): progress notification for the last chunk#2359

Closed
akdasa wants to merge 1 commit intoionic-team:mainfrom
akdasa:fix-filesystem-download-file-progress
Closed

fix(filesystem): progress notification for the last chunk#2359
akdasa wants to merge 1 commit intoionic-team:mainfrom
akdasa:fix-filesystem-download-file-progress

Conversation

@akdasa
Copy link

@akdasa akdasa commented May 4, 2025

The progress notification might not be triggered when a file finishes downloading if it completes too quickly due to the time-based threshold logic. As a result, the client may never receive a progress update showing 100% completion (it often stops at something like 98.1234%).

This PR ensures that the progress notification is sent when the file has fully downloaded, guaranteeing the client receives an update with 100% progress.

Improvements to progress update logic:

  • filesystem/ios/Sources/FilesystemPlugin/Filesystem.swift: Added isTimeToEmit and isLastChunk variables to clarify the conditions for emitting progress updates. This ensures that progress is emitted either when the time threshold (0.1 seconds) is reached or when the operation is complete (totalBytesWritten == totalBytesExpectedToWrite).

@OS-pedrogustavobilro
Copy link
Contributor

Hey @akdasa, thanks for this PR. The downloadFile for FileSystem Plugin is now deprecated, we recommend to use @capacitor/file-transfer, which I believe has this issue fixed.

Should you run into any other issues, feel free to open an issue at https://github.com/ionic-team/capacitor-file-transfer

I'll be closing this PR. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants