Open NRTnarathip opened 3 months ago
My code
var progress = new Progress<double>((percent) => { Console.WriteLine($"On update FileSaver: {percent}"); }); FileSaver.SaveAsync(fileName, stream, progress, cancelToken)
The progress callback "percent" it's always return 0
it's should return 0.11199 or 0.5123123 or 0.22332
How to fix code ref: https://github.com/CommunityToolkit/Maui/blob/d7a84df2b2d8db8c1597cabf32de63cd3dccd449/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs#L105
just change progress?.Report(totalRead / stream.Length); to progress?.Report((double)totalRead / stream.Length);
progress?.Report(totalRead / stream.Length);
progress?.Report((double)totalRead / stream.Length);
Thanks you
.
N.A.
- .NET MAUI CommunityToolkit:8.0.0
No response
And i found code here same like this issue calculate wrong in file **.shared.cs
https://github.com/CommunityToolkit/Maui/blob/d7a84df2b2d8db8c1597cabf32de63cd3dccd449/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.shared.cs#L86
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
My code
The progress callback "percent" it's always return 0
Expected Behavior
it's should return 0.11199 or 0.5123123 or 0.22332
How to fix code ref: https://github.com/CommunityToolkit/Maui/blob/d7a84df2b2d8db8c1597cabf32de63cd3dccd449/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs#L105
just change
progress?.Report(totalRead / stream.Length);
toprogress?.Report((double)totalRead / stream.Length);
Thanks you
Steps To Reproduce
.
Link to public reproduction project repository
N.A.
Environment
Anything else?
No response