mirror of
https://github.com/ninxsoft/Mist.git
synced 2025-05-24 03:57:13 -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 {
|
var id: String {
|
||||||
"\(String.appIdentifier).\(version)-\(build)"
|
"\(String.appIdentifier).\(version)-\(build)"
|
||||||
}
|
}
|
||||||
|
|
||||||
var name: String {
|
var name: String {
|
||||||
var name: String = ""
|
var name: String = ""
|
||||||
|
|
||||||
|
@ -65,6 +66,7 @@ struct Firmware: Decodable, Hashable, Identifiable {
|
||||||
name = beta ? "\(name) beta" : name
|
name = beta ? "\(name) beta" : name
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
let version: String
|
let version: String
|
||||||
let build: String
|
let build: String
|
||||||
let shasum: String
|
let shasum: String
|
||||||
|
@ -76,12 +78,15 @@ struct Firmware: Decodable, Hashable, Identifiable {
|
||||||
var formattedDate: String {
|
var formattedDate: String {
|
||||||
String(date.prefix(10))
|
String(date.prefix(10))
|
||||||
}
|
}
|
||||||
|
|
||||||
var beta: Bool {
|
var beta: Bool {
|
||||||
build.range(of: "[a-z]$", options: .regularExpression) != nil
|
build.range(of: "[a-z]$", options: .regularExpression) != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var imageName: String {
|
var imageName: String {
|
||||||
name.replacingOccurrences(of: " beta", with: "")
|
name.replacingOccurrences(of: " beta", with: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
var dictionary: [String: Any] {
|
var dictionary: [String: Any] {
|
||||||
[
|
[
|
||||||
"name": name,
|
"name": name,
|
||||||
|
@ -95,6 +100,7 @@ struct Firmware: Decodable, Hashable, Identifiable {
|
||||||
"beta": beta
|
"beta": beta
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
var tooltip: String {
|
var tooltip: String {
|
||||||
"""
|
"""
|
||||||
Release: \(name)
|
Release: \(name)
|
||||||
|
|
|
@ -24,6 +24,7 @@ struct Hardware {
|
||||||
static var boardID: String? {
|
static var boardID: String? {
|
||||||
architecture == .intel ? registryProperty(for: "board-id") : nil
|
architecture == .intel ? registryProperty(for: "board-id") : nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Hardware Device ID (Apple Silicon or Intel T2).
|
/// Hardware Device ID (Apple Silicon or Intel T2).
|
||||||
static var deviceID: String? {
|
static var deviceID: String? {
|
||||||
switch architecture {
|
switch architecture {
|
||||||
|
@ -35,6 +36,7 @@ struct Hardware {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Hardware Model Identifier (Apple Silicon or Intel).
|
/// Hardware Model Identifier (Apple Silicon or Intel).
|
||||||
static var modelIdentifier: String? {
|
static var modelIdentifier: String? {
|
||||||
registryProperty(for: "model")
|
registryProperty(for: "model")
|
||||||
|
|
|
@ -688,6 +688,7 @@ struct Installer: Decodable, Hashable, Identifiable {
|
||||||
name = beta ? "\(name) beta" : name
|
name = beta ? "\(name) beta" : name
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
var compatible: Bool {
|
var compatible: Bool {
|
||||||
// Board ID (Intel)
|
// Board ID (Intel)
|
||||||
if let boardID: String = Hardware.boardID,
|
if let boardID: String = Hardware.boardID,
|
||||||
|
@ -722,18 +723,23 @@ struct Installer: Decodable, Hashable, Identifiable {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
var allDownloads: [Package] {
|
var allDownloads: [Package] {
|
||||||
(sierraOrOlder ? [] : [Package(url: distributionURL, size: distributionSize, integrityDataURL: nil, integrityDataSize: nil)]) + packages.sorted { $0.filename < $1.filename }
|
(sierraOrOlder ? [] : [Package(url: distributionURL, size: distributionSize, integrityDataURL: nil, integrityDataSize: nil)]) + packages.sorted { $0.filename < $1.filename }
|
||||||
}
|
}
|
||||||
|
|
||||||
var temporaryDiskImageMountPointURL: URL {
|
var temporaryDiskImageMountPointURL: URL {
|
||||||
URL(fileURLWithPath: "/Volumes/\(id)")
|
URL(fileURLWithPath: "/Volumes/\(id)")
|
||||||
}
|
}
|
||||||
|
|
||||||
var temporaryInstallerURL: URL {
|
var temporaryInstallerURL: URL {
|
||||||
temporaryDiskImageMountPointURL.appendingPathComponent("Applications/Install \(name).app")
|
temporaryDiskImageMountPointURL.appendingPathComponent("Applications/Install \(name).app")
|
||||||
}
|
}
|
||||||
|
|
||||||
var temporaryISOMountPointURL: URL {
|
var temporaryISOMountPointURL: URL {
|
||||||
URL(fileURLWithPath: "/Volumes/Install \(name)")
|
URL(fileURLWithPath: "/Volumes/Install \(name)")
|
||||||
}
|
}
|
||||||
|
|
||||||
var dictionary: [String: Any] {
|
var dictionary: [String: Any] {
|
||||||
[
|
[
|
||||||
"identifier": id,
|
"identifier": id,
|
||||||
|
@ -748,33 +754,43 @@ struct Installer: Decodable, Hashable, Identifiable {
|
||||||
"beta": beta
|
"beta": beta
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
var mavericksOrNewer: Bool {
|
var mavericksOrNewer: Bool {
|
||||||
bigSurOrNewer || version.range(of: "^10\\.(9|1[0-5])\\.", options: .regularExpression) != nil
|
bigSurOrNewer || version.range(of: "^10\\.(9|1[0-5])\\.", options: .regularExpression) != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var sierraOrOlder: Bool {
|
var sierraOrOlder: Bool {
|
||||||
version.range(of: "^10\\.([7-9]|1[0-2])\\.", options: .regularExpression) != nil
|
version.range(of: "^10\\.([7-9]|1[0-2])\\.", options: .regularExpression) != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var catalinaOrNewer: Bool {
|
var catalinaOrNewer: Bool {
|
||||||
bigSurOrNewer || version.range(of: "^10\\.15\\.", options: .regularExpression) != nil
|
bigSurOrNewer || version.range(of: "^10\\.15\\.", options: .regularExpression) != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var bigSurOrNewer: Bool {
|
var bigSurOrNewer: Bool {
|
||||||
version.range(of: "^1[1-9]\\.", options: .regularExpression) != nil
|
version.range(of: "^1[1-9]\\.", options: .regularExpression) != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var beta: Bool {
|
var beta: Bool {
|
||||||
build.range(of: "[a-z]$", options: .regularExpression) != nil
|
build.range(of: "[a-z]$", options: .regularExpression) != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var imageName: String {
|
var imageName: String {
|
||||||
name.replacingOccurrences(of: " beta", with: "")
|
name.replacingOccurrences(of: " beta", with: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
var size: UInt64 {
|
var size: UInt64 {
|
||||||
UInt64(packages.map { $0.size }.reduce(0, +))
|
UInt64(packages.map { $0.size }.reduce(0, +))
|
||||||
}
|
}
|
||||||
|
|
||||||
var diskImageSize: Double {
|
var diskImageSize: Double {
|
||||||
ceil(Double(size) / Double(UInt64.gigabyte)) + 1.5
|
ceil(Double(size) / Double(UInt64.gigabyte)) + 1.5
|
||||||
}
|
}
|
||||||
|
|
||||||
var isoSize: Double {
|
var isoSize: Double {
|
||||||
ceil(Double(size) / Double(UInt64.gigabyte)) + 1.5
|
ceil(Double(size) / Double(UInt64.gigabyte)) + 1.5
|
||||||
}
|
}
|
||||||
|
|
||||||
var tooltip: String {
|
var tooltip: String {
|
||||||
"""
|
"""
|
||||||
Release: \(name)
|
Release: \(name)
|
||||||
|
|
|
@ -22,6 +22,7 @@ struct Package: Decodable, Hashable {
|
||||||
var filename: String {
|
var filename: String {
|
||||||
url.components(separatedBy: "/").last ?? url
|
url.components(separatedBy: "/").last ?? url
|
||||||
}
|
}
|
||||||
|
|
||||||
var dictionary: [String: Any] {
|
var dictionary: [String: Any] {
|
||||||
[
|
[
|
||||||
"url": url,
|
"url": url,
|
||||||
|
|
|
@ -38,9 +38,11 @@ struct ActivityView: View {
|
||||||
private var bootableInstaller: Bool {
|
private var bootableInstaller: Bool {
|
||||||
taskManager.taskGroups.map { $0.section }.contains(.bootableInstaller)
|
taskManager.taskGroups.map { $0.section }.contains(.bootableInstaller)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var venturaOrOlder: Bool {
|
private var venturaOrOlder: Bool {
|
||||||
!ProcessInfo().isOperatingSystemAtLeast(OperatingSystemVersion(majorVersion: 14, minorVersion: 0, patchVersion: 0))
|
!ProcessInfo().isOperatingSystemAtLeast(OperatingSystemVersion(majorVersion: 14, minorVersion: 0, patchVersion: 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
private var buttonText: String {
|
private var buttonText: String {
|
||||||
switch taskManager.currentState {
|
switch taskManager.currentState {
|
||||||
case .pending, .inProgress:
|
case .pending, .inProgress:
|
||||||
|
|
|
@ -45,6 +45,7 @@ struct ContentView: View {
|
||||||
|
|
||||||
return filteredFirmwares
|
return filteredFirmwares
|
||||||
}
|
}
|
||||||
|
|
||||||
private var filteredInstallers: [Installer] {
|
private var filteredInstallers: [Installer] {
|
||||||
var filteredInstallers: [Installer] = installers
|
var filteredInstallers: [Installer] = installers
|
||||||
|
|
||||||
|
@ -68,6 +69,7 @@ struct ContentView: View {
|
||||||
|
|
||||||
return filteredInstallers
|
return filteredInstallers
|
||||||
}
|
}
|
||||||
|
|
||||||
private let width: CGFloat = 480
|
private let width: CGFloat = 480
|
||||||
private let height: CGFloat = 720
|
private let height: CGFloat = 720
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct InstallerExportView: View {
|
||||||
|
|
||||||
return architecture == .intel || (architecture == .appleSilicon && installer.bigSurOrNewer)
|
return architecture == .intel || (architecture == .appleSilicon && installer.bigSurOrNewer)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var compatibilityMessage: String {
|
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)."
|
"**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?"
|
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 {
|
private var errorMessage: String {
|
||||||
if let error: BlessError = error as? BlessError {
|
if let error: BlessError = error as? BlessError {
|
||||||
return error.description
|
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?"
|
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 {
|
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."
|
"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 {
|
private var errorMessage: String {
|
||||||
if let error: BlessError = error as? BlessError {
|
if let error: BlessError = error as? BlessError {
|
||||||
return error.description
|
return error.description
|
||||||
|
|
|
@ -19,6 +19,7 @@ struct RefreshView: View {
|
||||||
private var height: CGFloat {
|
private var height: CGFloat {
|
||||||
firmwaresState == .warning ? 230 : 200
|
firmwaresState == .warning ? 230 : 200
|
||||||
}
|
}
|
||||||
|
|
||||||
private var buttonText: String {
|
private var buttonText: String {
|
||||||
[.pending, .inProgress].contains(firmwaresState) || [.pending, .inProgress].contains(installersState) ? "Cancel" : "Close"
|
[.pending, .inProgress].contains(firmwaresState) || [.pending, .inProgress].contains(installersState) ? "Cancel" : "Close"
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,11 @@ struct SettingsAboutView: View {
|
||||||
private var version: String {
|
private var version: String {
|
||||||
Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
|
Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
private var build: String {
|
private var build: String {
|
||||||
Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""
|
Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
private let length: CGFloat = 128
|
private let length: CGFloat = 128
|
||||||
private let spacing: CGFloat = 3
|
private let spacing: CGFloat = 3
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ struct SettingsGeneralHelperView: View {
|
||||||
let version: BundleVersion = installed.version
|
let version: BundleVersion = installed.version
|
||||||
return "Installed (\(version.major).\(version.minor).\(version.patch))"
|
return "Installed (\(version.major).\(version.minor).\(version.patch))"
|
||||||
}
|
}
|
||||||
|
|
||||||
private var errorMessage: String {
|
private var errorMessage: String {
|
||||||
if let error: BlessError = error as? BlessError {
|
if let error: BlessError = error as? BlessError {
|
||||||
return error.description
|
return error.description
|
||||||
|
|
|
@ -80,4 +80,5 @@ server.setErrorHandler { error in
|
||||||
NSLog("error: \(error)")
|
NSLog("error: \(error)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server.startAndBlock()
|
server.startAndBlock()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue