mirror of
https://github.com/ninxsoft/Mist.git
synced 2025-05-23 19:47:08 -04:00
SwiftFormat blankLinesBetweenScopes
This commit is contained in:
parent
779d0a4e48
commit
aac0b11742
13 changed files with 38 additions and 0 deletions
|
@ -47,6 +47,7 @@ struct Firmware: Decodable, Hashable, Identifiable {
|
|||
var id: String {
|
||||
"\(String.appIdentifier).\(version)-\(build)"
|
||||
}
|
||||
|
||||
var name: String {
|
||||
var name: String = ""
|
||||
|
||||
|
@ -65,6 +66,7 @@ struct Firmware: Decodable, Hashable, Identifiable {
|
|||
name = beta ? "\(name) beta" : name
|
||||
return name
|
||||
}
|
||||
|
||||
let version: String
|
||||
let build: String
|
||||
let shasum: String
|
||||
|
@ -76,12 +78,15 @@ struct Firmware: Decodable, Hashable, Identifiable {
|
|||
var formattedDate: String {
|
||||
String(date.prefix(10))
|
||||
}
|
||||
|
||||
var beta: Bool {
|
||||
build.range(of: "[a-z]$", options: .regularExpression) != nil
|
||||
}
|
||||
|
||||
var imageName: String {
|
||||
name.replacingOccurrences(of: " beta", with: "")
|
||||
}
|
||||
|
||||
var dictionary: [String: Any] {
|
||||
[
|
||||
"name": name,
|
||||
|
@ -95,6 +100,7 @@ struct Firmware: Decodable, Hashable, Identifiable {
|
|||
"beta": beta
|
||||
]
|
||||
}
|
||||
|
||||
var tooltip: String {
|
||||
"""
|
||||
Release: \(name)
|
||||
|
|
|
@ -24,6 +24,7 @@ struct Hardware {
|
|||
static var boardID: String? {
|
||||
architecture == .intel ? registryProperty(for: "board-id") : nil
|
||||
}
|
||||
|
||||
/// Hardware Device ID (Apple Silicon or Intel T2).
|
||||
static var deviceID: String? {
|
||||
switch architecture {
|
||||
|
@ -35,6 +36,7 @@ struct Hardware {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/// Hardware Model Identifier (Apple Silicon or Intel).
|
||||
static var modelIdentifier: String? {
|
||||
registryProperty(for: "model")
|
||||
|
|
|
@ -688,6 +688,7 @@ struct Installer: Decodable, Hashable, Identifiable {
|
|||
name = beta ? "\(name) beta" : name
|
||||
return name
|
||||
}
|
||||
|
||||
var compatible: Bool {
|
||||
// Board ID (Intel)
|
||||
if let boardID: String = Hardware.boardID,
|
||||
|
@ -722,18 +723,23 @@ struct Installer: Decodable, Hashable, Identifiable {
|
|||
|
||||
return true
|
||||
}
|
||||
|
||||
var allDownloads: [Package] {
|
||||
(sierraOrOlder ? [] : [Package(url: distributionURL, size: distributionSize, integrityDataURL: nil, integrityDataSize: nil)]) + packages.sorted { $0.filename < $1.filename }
|
||||
}
|
||||
|
||||
var temporaryDiskImageMountPointURL: URL {
|
||||
URL(fileURLWithPath: "/Volumes/\(id)")
|
||||
}
|
||||
|
||||
var temporaryInstallerURL: URL {
|
||||
temporaryDiskImageMountPointURL.appendingPathComponent("Applications/Install \(name).app")
|
||||
}
|
||||
|
||||
var temporaryISOMountPointURL: URL {
|
||||
URL(fileURLWithPath: "/Volumes/Install \(name)")
|
||||
}
|
||||
|
||||
var dictionary: [String: Any] {
|
||||
[
|
||||
"identifier": id,
|
||||
|
@ -748,33 +754,43 @@ struct Installer: Decodable, Hashable, Identifiable {
|
|||
"beta": beta
|
||||
]
|
||||
}
|
||||
|
||||
var mavericksOrNewer: Bool {
|
||||
bigSurOrNewer || version.range(of: "^10\\.(9|1[0-5])\\.", options: .regularExpression) != nil
|
||||
}
|
||||
|
||||
var sierraOrOlder: Bool {
|
||||
version.range(of: "^10\\.([7-9]|1[0-2])\\.", options: .regularExpression) != nil
|
||||
}
|
||||
|
||||
var catalinaOrNewer: Bool {
|
||||
bigSurOrNewer || version.range(of: "^10\\.15\\.", options: .regularExpression) != nil
|
||||
}
|
||||
|
||||
var bigSurOrNewer: Bool {
|
||||
version.range(of: "^1[1-9]\\.", options: .regularExpression) != nil
|
||||
}
|
||||
|
||||
var beta: Bool {
|
||||
build.range(of: "[a-z]$", options: .regularExpression) != nil
|
||||
}
|
||||
|
||||
var imageName: String {
|
||||
name.replacingOccurrences(of: " beta", with: "")
|
||||
}
|
||||
|
||||
var size: UInt64 {
|
||||
UInt64(packages.map { $0.size }.reduce(0, +))
|
||||
}
|
||||
|
||||
var diskImageSize: Double {
|
||||
ceil(Double(size) / Double(UInt64.gigabyte)) + 1.5
|
||||
}
|
||||
|
||||
var isoSize: Double {
|
||||
ceil(Double(size) / Double(UInt64.gigabyte)) + 1.5
|
||||
}
|
||||
|
||||
var tooltip: String {
|
||||
"""
|
||||
Release: \(name)
|
||||
|
|
|
@ -22,6 +22,7 @@ struct Package: Decodable, Hashable {
|
|||
var filename: String {
|
||||
url.components(separatedBy: "/").last ?? url
|
||||
}
|
||||
|
||||
var dictionary: [String: Any] {
|
||||
[
|
||||
"url": url,
|
||||
|
|
|
@ -38,9 +38,11 @@ struct ActivityView: View {
|
|||
private var bootableInstaller: Bool {
|
||||
taskManager.taskGroups.map { $0.section }.contains(.bootableInstaller)
|
||||
}
|
||||
|
||||
private var venturaOrOlder: Bool {
|
||||
!ProcessInfo().isOperatingSystemAtLeast(OperatingSystemVersion(majorVersion: 14, minorVersion: 0, patchVersion: 0))
|
||||
}
|
||||
|
||||
private var buttonText: String {
|
||||
switch taskManager.currentState {
|
||||
case .pending, .inProgress:
|
||||
|
|
|
@ -45,6 +45,7 @@ struct ContentView: View {
|
|||
|
||||
return filteredFirmwares
|
||||
}
|
||||
|
||||
private var filteredInstallers: [Installer] {
|
||||
var filteredInstallers: [Installer] = installers
|
||||
|
||||
|
@ -68,6 +69,7 @@ struct ContentView: View {
|
|||
|
||||
return filteredInstallers
|
||||
}
|
||||
|
||||
private let width: CGFloat = 480
|
||||
private let height: CGFloat = 720
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ struct InstallerExportView: View {
|
|||
|
||||
return architecture == .intel || (architecture == .appleSilicon && installer.bigSurOrNewer)
|
||||
}
|
||||
|
||||
private var compatibilityMessage: String {
|
||||
"**Note:** ISOs are unavailable for building **macOS Catalina 10.15 and older** on [Apple Silicon Macs](https://support.apple.com/en-us/HT211814)."
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ struct ListRowFirmware: View {
|
|||
|
||||
return "This macOS Firmware download cannot be used to restore macOS on this \(architecture.description) Mac.\n\nAre you sure you want to continue?"
|
||||
}
|
||||
|
||||
private var errorMessage: String {
|
||||
if let error: BlessError = error as? BlessError {
|
||||
return error.description
|
||||
|
|
|
@ -59,9 +59,11 @@ struct ListRowInstaller: View {
|
|||
|
||||
return "This macOS Installer download cannot be used to restore macOS on this \(architecture.description) Mac.\n\nAre you sure you want to continue?"
|
||||
}
|
||||
|
||||
private var cacheDirectoryMessage: String {
|
||||
"The cache directory has incorrect ownership and/or permissions, which will cause issues caching macOS Installers.\n\nRepair the cache directory ownership and/or permissions and try again."
|
||||
}
|
||||
|
||||
private var errorMessage: String {
|
||||
if let error: BlessError = error as? BlessError {
|
||||
return error.description
|
||||
|
|
|
@ -19,6 +19,7 @@ struct RefreshView: View {
|
|||
private var height: CGFloat {
|
||||
firmwaresState == .warning ? 230 : 200
|
||||
}
|
||||
|
||||
private var buttonText: String {
|
||||
[.pending, .inProgress].contains(firmwaresState) || [.pending, .inProgress].contains(installersState) ? "Cancel" : "Close"
|
||||
}
|
||||
|
|
|
@ -13,9 +13,11 @@ struct SettingsAboutView: View {
|
|||
private var version: String {
|
||||
Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
|
||||
}
|
||||
|
||||
private var build: String {
|
||||
Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""
|
||||
}
|
||||
|
||||
private let length: CGFloat = 128
|
||||
private let spacing: CGFloat = 3
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ struct SettingsGeneralHelperView: View {
|
|||
let version: BundleVersion = installed.version
|
||||
return "Installed (\(version.major).\(version.minor).\(version.patch))"
|
||||
}
|
||||
|
||||
private var errorMessage: String {
|
||||
if let error: BlessError = error as? BlessError {
|
||||
return error.description
|
||||
|
|
|
@ -80,4 +80,5 @@ server.setErrorHandler { error in
|
|||
NSLog("error: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
server.startAndBlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue