mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-26 13:20:48 +00:00
Pause, cancel & resume backup media download
This commit is contained in:
@@ -57,3 +57,23 @@ export function safeParseBigint(
|
||||
}
|
||||
return BigInt(value);
|
||||
}
|
||||
|
||||
export function roundFractionForProgressBar(fractionComplete: number): number {
|
||||
if (fractionComplete <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fractionComplete >= 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fractionComplete <= 0.01) {
|
||||
return 0.01;
|
||||
}
|
||||
|
||||
if (fractionComplete >= 0.99) {
|
||||
return 0.99;
|
||||
}
|
||||
|
||||
return Math.round(fractionComplete * 100) / 100;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user