fix(downloads): hide unknown byte totals in notifications

This commit is contained in:
zarzet
2026-08-30 18:58:19 +07:00
parent 892d152e5c
commit 2e0a5f7b9c
4 changed files with 23 additions and 4 deletions
@@ -373,8 +373,11 @@ extension _DownloadQueueProgress on DownloadQueueNotifier {
notifProgress = 0;
notifTotal = 0;
} else if (bytesTotal <= 0) {
notifProgress = (progressPercent * 100).toInt();
notifTotal = 100;
notifTotal = PlatformBridge.notificationPercentTotal;
notifProgress = (progressPercent * notifTotal)
.round()
.clamp(0, notifTotal)
.toInt();
}
final serviceStatus = notifTotal <= 0 ? 'preparing' : 'downloading';
+4
View File
@@ -145,6 +145,10 @@ class _BridgeInFlight<T> {
}
class PlatformBridge {
/// Sentinel shared with Android's foreground service for progress reports
/// that contain a percentage but no byte counts.
static const int notificationPercentTotal = 10000;
static const _channel = MethodChannel('com.zarz.spotiflac/backend');
static const _jsonResultFileKey = '__json_file';
static const _backgroundJsonDecodeThresholdBytes = 128 * 1024;