Merge pull request #575 from rgoldberg/574-app-id-value

`appIDValue` to encapsulate `uint64Value`.
This commit is contained in:
Ross Goldberg 2024-10-15 08:11:19 -04:00 committed by GitHub
commit de13ad12f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 5 deletions

View file

@ -33,7 +33,7 @@ extension Mas {
fulfilled:
appLibrary.installedApps.map { installedApp in
firstly {
storeSearch.lookup(appID: installedApp.itemIdentifier.uint64Value)
storeSearch.lookup(appID: installedApp.itemIdentifier.appIDValue)
}.done { storeApp in
guard let storeApp else {
if verbose {

View file

@ -44,7 +44,7 @@ extension Mas {
.joined(separator: "\n"))
do {
try downloadAll(apps.map(\.installedApp.itemIdentifier.uint64Value)).wait()
try downloadAll(apps.map(\.installedApp.itemIdentifier.appIDValue)).wait()
} catch {
throw error as? MASError ?? .downloadFailed(error: error as NSError)
}
@ -70,7 +70,7 @@ extension Mas {
let promises = apps.map { installedApp in
// only upgrade apps whose local version differs from the store version
firstly {
storeSearch.lookup(appID: installedApp.itemIdentifier.uint64Value)
storeSearch.lookup(appID: installedApp.itemIdentifier.appIDValue)
}.map { result -> (SoftwareProduct, SearchResult)? in
guard let storeApp = result, installedApp.isOutdatedWhenComparedTo(storeApp) else {
return nil

View file

@ -7,10 +7,9 @@
//
import ArgumentParser
import Foundation
import PromiseKit
typealias AppID = UInt64
@main
struct Mas: ParsableCommand {
static let configuration = CommandConfiguration(
@ -56,3 +55,11 @@ struct Mas: ParsableCommand {
}
}
}
typealias AppID = UInt64
extension NSNumber {
var appIDValue: AppID {
uint64Value
}
}