mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Download process string updated to match master
This commit is contained in:
1 parent
67320fcb80
commit
b3ecc89f11
1 file changed
+27
-2
Vendored
+27
-2
@@ -17,6 +17,7 @@
|
||||
#import "SUUpdateAlert.h"
|
||||
#import "SULocalizations.h"
|
||||
#import "SUApplicationInfo.h"
|
||||
#import "SUOperatingSystem.h"
|
||||
|
||||
@interface SPUStandardUserDriver ()
|
||||
|
||||
@@ -339,8 +340,32 @@
|
||||
|
||||
- (NSString *)localizedStringFromByteCount:(long long)value
|
||||
{
|
||||
return [NSByteCountFormatter stringFromByteCount:value
|
||||
countStyle:NSByteCountFormatterCountStyleFile];
|
||||
if (![SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 8, 0}]) {
|
||||
if (value < 1000) {
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value / 1.0,
|
||||
SULocalizedString(@"B", @"the unit for bytes")];
|
||||
}
|
||||
|
||||
if (value < 1000 * 1000) {
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value / 1000.0,
|
||||
SULocalizedString(@"KB", @"the unit for kilobytes")];
|
||||
}
|
||||
|
||||
if (value < 1000 * 1000 * 1000) {
|
||||
return [NSString stringWithFormat:@"%.1lf %@", value / 1000.0 / 1000.0,
|
||||
SULocalizedString(@"MB", @"the unit for megabytes")];
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:@"%.2lf %@", value / 1000.0 / 1000.0 / 1000.0,
|
||||
SULocalizedString(@"GB", @"the unit for gigabytes")];
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
NSByteCountFormatter *formatter = [[NSByteCountFormatter alloc] init];
|
||||
[formatter setZeroPadsFractionDigits:YES];
|
||||
return [formatter stringFromByteCount:value];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
- (void)showDownloadDidReceiveDataOfLength:(uint64_t)length
|
||||
|
||||
Reference in new issue
Block a user