feat: place upload above download in macOS badge (#4055)

This commit is contained in:
Gary Elshaw 2022-11-08 08:21:49 +13:00 committed by GitHub
parent cb932ddf8d
commit c32161f7ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 11 deletions

View File

@ -54,19 +54,19 @@ static CGFloat const kBetweenPadding = 2.0;
BOOL const upload = self.fUploadRate >= 0.1;
BOOL const download = self.fDownloadRate >= 0.1;
CGFloat bottom = 0.0;
if (upload)
{
NSImage* uploadBadge = [NSImage imageNamed:@"UploadBadge"];
[self badge:uploadBadge string:[NSString stringForSpeedAbbrev:self.fUploadRate] atHeight:bottom];
if (download)
{
bottom += uploadBadge.size.height + kBetweenPadding; //download rate above upload rate
}
}
if (download)
{
[self badge:[NSImage imageNamed:@"DownloadBadge"] string:[NSString stringForSpeedAbbrev:self.fDownloadRate] atHeight:bottom];
NSImage* downloadBadge = [NSImage imageNamed:@"DownloadBadge"];
[self badge:downloadBadge string:[NSString stringForSpeedAbbrev:self.fDownloadRate] atHeight:bottom];
if (upload)
{
bottom += downloadBadge.size.height + kBetweenPadding; //upload rate above download rate
}
}
if (upload)
{
[self badge:[NSImage imageNamed:@"UploadBadge"] string:[NSString stringForSpeedAbbrev:self.fUploadRate] atHeight:bottom];
}
}