appIDValue to encapsulate uint64Value.

Resolve #574

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
Ross Goldberg 2024-10-14 20:53:26 -04:00
parent 8c5890f46d
commit b0d0f4aacd
No known key found for this signature in database
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
}
}