An open-source cross-platform alternative to AirDrop
fix: crash when files bigger than 2 GB (#1512)
Tien Do Namf97b5ba86bea
diff --git a/app/assets/CHANGELOG.md b/app/assets/CHANGELOG.mdindex b6357caf..071f7c33 100644--- a/app/assets/CHANGELOG.md+++ b/app/assets/CHANGELOG.md@@ -1,3 +1,7 @@+## 1.15.1 (unreleased)++- fix(windows): crash when sum of file sizes greater than 2 GB (@Tienisto)+## 1.15.0 (2024-07-15)- feat: add clear button in the send tab (@Caesarovich)diff --git a/app/lib/util/native/taskbar_helper.dart b/app/lib/util/native/taskbar_helper.dartindex 3087bc85..b3afb1a3 100644--- a/app/lib/util/native/taskbar_helper.dart+++ b/app/lib/util/native/taskbar_helper.dart@@ -16,9 +16,12 @@ class TaskbarHelper {}static Future<void> setProgressBar(int progress, int total) async {+ // Scale down to 0-100 range because Windows Taskbar only supports 32-bit integers+ // This ensures that files with a size of 2^32 bytes or greater can still be displayed correctly+ final (digestedProgress, digestedTotal) = _scaleRange(progress, total);if (total != double.minPositive.toInt() && total != double.maxFinite.toInt()) {if (_isWindows) {- await WindowsTaskbar.setProgress(progress, total);+ await WindowsTaskbar.setProgress(digestedProgress, digestedTotal);} else if (_isMacos) {// await DockProgress.setProgress(double.parse((progress / total).toStringAsFixed(3)));}@@ -35,3 +38,8 @@ class TaskbarHelper {}}}++(int, int) _scaleRange(int progress, int total) {+ final percentage = progress / total;+ return ((percentage * 100).toInt(), 100);+}