diff --git a/Sources/mas/AppStore/ISStoreAccount.swift b/Sources/mas/AppStore/ISStoreAccount.swift index 414dc29..1c8afa0 100644 --- a/Sources/mas/AppStore/ISStoreAccount.swift +++ b/Sources/mas/AppStore/ISStoreAccount.swift @@ -10,6 +10,8 @@ import CommerceKit import PromiseKit import StoreFoundation +private let timeout = 30.0 + extension ISStoreAccount: StoreAccount { static var primaryAccount: Promise { if #available(macOS 10.13, *) { @@ -20,7 +22,7 @@ extension ISStoreAccount: StoreAccount { seal.fulfill(storeAccount) } }, - after(seconds: 30) + after(seconds: timeout) .then { Promise(error: MASError.notSignedIn) } @@ -79,7 +81,7 @@ extension ISStoreAccount: StoreAccount { return race( signInPromise, - after(seconds: 30) + after(seconds: timeout) .then { Promise(error: MASError.signInFailed(error: nil)) } diff --git a/Sources/mas/AppStore/PurchaseDownloadObserver.swift b/Sources/mas/AppStore/PurchaseDownloadObserver.swift index fd4add4..c6709cf 100644 --- a/Sources/mas/AppStore/PurchaseDownloadObserver.swift +++ b/Sources/mas/AppStore/PurchaseDownloadObserver.swift @@ -65,6 +65,7 @@ struct ProgressState { let phase: String var percentage: String { + // swiftlint:disable:next no_magic_numbers String(format: "%.1f%%", floor(percentComplete * 1000) / 10) } } diff --git a/Sources/mas/Formatters/SearchResultFormatter.swift b/Sources/mas/Formatters/SearchResultFormatter.swift index 96e9414..7145d87 100644 --- a/Sources/mas/Formatters/SearchResultFormatter.swift +++ b/Sources/mas/Formatters/SearchResultFormatter.swift @@ -17,8 +17,10 @@ enum SearchResultFormatter { /// - includePrice: Indicates whether to include prices in the output /// - Returns: Multiline text output. static func format(results: [SearchResult], includePrice: Bool = false) -> String { - // find longest appName for formatting, default 50 - let maxLength = results.map(\.trackName.count).max() ?? 50 + guard let maxLength = results.map(\.trackName.count).max() else { + return "" + } + var output = "" for result in results {