Skip to content

Commit

Permalink
Fix FileSaver Progress (#2277)
Browse files Browse the repository at this point in the history
  • Loading branch information
VladislavAntonyuk authored Oct 14, 2024
1 parent 1319fb9 commit 49644cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static async Task<string> SaveDocument(AndroidUri uri, Stream stream, IProgress<
{
await fileOutputStream.WriteAsync(buffer, 0, bytesRead).WaitAsync(cancellationToken).ConfigureAwait(false);
totalRead += bytesRead;
progress?.Report(totalRead / stream.Length);
progress?.Report((double)totalRead / stream.Length);
}

if (fileOutputStream.Channel is not null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static async Task WriteStream(Stream stream, string filePath, IProgress<double>?
try
{
int bytesRead;
long totalRead = 0;
double totalRead = 0;
while ((bytesRead = await stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false)) > 0)
{
await fileStream.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false);
Expand Down

0 comments on commit 49644cb

Please sign in to comment.