Skip to content

Commit

Permalink
Now displays download size
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptingosx committed Jun 22, 2021
1 parent b1c821d commit 7fd501c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions FetchInstallerPkg.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 21;
DEVELOPMENT_ASSET_PATHS = "\"FetchInstallerPkg/Preview Content\"";
DEVELOPMENT_TEAM = JME5BW3F3R;
ENABLE_APP_SANDBOX = YES;
Expand Down Expand Up @@ -409,7 +409,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 21;
DEVELOPMENT_ASSET_PATHS = "\"FetchInstallerPkg/Preview Content\"";
DEVELOPMENT_TEAM = JME5BW3F3R;
ENABLE_APP_SANDBOX = YES;
Expand Down
11 changes: 9 additions & 2 deletions FetchInstallerPkg/Model/Product.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,20 @@ class Product: Codable, Identifiable, ObservableObject {
return buildManifest?.url
}

var installerPackage: Package? {
return packages.first { $0.url.hasSuffix("InstallAssistant.pkg")}
}

var installAssistantURL: URL? {
if let installAssistant = packages.first(where: { $0.url.hasSuffix("InstallAssistant.pkg")}) {
if let installAssistant = self.installerPackage {
return URL(string: installAssistant.url)
} else {
return nil
}

}

var installAssistantSize: Int {
return self.installerPackage?.size ?? 0
}

func loadBuildManifest() {
Expand Down
2 changes: 2 additions & 0 deletions FetchInstallerPkg/Prefs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ struct Prefs {
let downloadURL = URL(fileURLWithPath: self.downloadPath)
return downloadURL
}

static let byteFormatter = ByteCountFormatter()
}
2 changes: 1 addition & 1 deletion FetchInstallerPkg/View/DownloadView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct DownloadView: View {
Button(action: {
downloadManager.revealInFinder()
}) {
Image(systemName: "magnifyingglass.circle")
Image(systemName: "magnifyingglass")
Text("Show in Finder")
}
}
Expand Down
2 changes: 2 additions & 0 deletions FetchInstallerPkg/View/InstallerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ struct InstallerView: View {
HStack {
Text(product.postDate, style: .date)
.font(.footnote)
Text(Prefs.byteFormatter.string(fromByteCount: Int64(product.installAssistantSize)))
.font(.footnote)
Spacer()
Text(product.buildVersion ?? "<no build>")
.frame(alignment: .trailing)
Expand Down

0 comments on commit 7fd501c

Please sign in to comment.