diff --git a/Sources/mas/AppStore/ISStoreAccount.swift b/Sources/mas/AppStore/ISStoreAccount.swift index ecb3313..56b7bd6 100644 --- a/Sources/mas/AppStore/ISStoreAccount.swift +++ b/Sources/mas/AppStore/ISStoreAccount.swift @@ -32,7 +32,7 @@ extension ISStoreAccount: StoreAccount { return .value(CKAccountStore.shared().primaryAccount) } - static func signIn(username: String, password: String, systemDialog: Bool) -> Promise { + static func signIn(appleID: String, password: String, systemDialog: Bool) -> Promise { // swift-format-ignore: UseEarlyExits if #available(macOS 10.13, *) { // Signing in is no longer possible as of High Sierra. @@ -44,7 +44,7 @@ extension ISStoreAccount: StoreAccount { primaryAccount .then { account -> Promise in if account.isSignedIn { - return Promise(error: MASError.alreadySignedIn(asAccountId: account.identifier)) + return Promise(error: MASError.alreadySignedIn(asAppleID: account.identifier)) } let password = @@ -57,7 +57,7 @@ extension ISStoreAccount: StoreAccount { } let context = ISAuthenticationContext(accountID: 0) - context.appleIDOverride = username + context.appleIDOverride = appleID let signInPromise = Promise { seal in @@ -77,7 +77,7 @@ extension ISStoreAccount: StoreAccount { } context.demoMode = true - context.demoAccountName = username + context.demoAccountName = appleID context.demoAccountPassword = password context.demoAutologinMode = true diff --git a/Sources/mas/Commands/SignIn.swift b/Sources/mas/Commands/SignIn.swift index ea332a3..aaa4a96 100644 --- a/Sources/mas/Commands/SignIn.swift +++ b/Sources/mas/Commands/SignIn.swift @@ -19,14 +19,14 @@ extension Mas { @Flag(help: "Complete login with graphical dialog") var dialog = false @Argument(help: "Apple ID") - var username: String + var appleID: String @Argument(help: "Password") var password: String = "" /// Runs the command. func run() throws { do { - _ = try ISStoreAccount.signIn(username: username, password: password, systemDialog: dialog).wait() + _ = try ISStoreAccount.signIn(appleID: appleID, password: password, systemDialog: dialog).wait() } catch { throw error as? MASError ?? MASError.signInFailed(error: error as NSError) } diff --git a/Sources/mas/Errors/MASError.swift b/Sources/mas/Errors/MASError.swift index 7aea57f..1d31b7f 100644 --- a/Sources/mas/Errors/MASError.swift +++ b/Sources/mas/Errors/MASError.swift @@ -18,7 +18,7 @@ enum MASError: Error, Equatable { case notSignedIn case noPasswordProvided case signInFailed(error: NSError?) - case alreadySignedIn(asAccountId: String) + case alreadySignedIn(asAppleID: String) case purchaseFailed(error: NSError?) case downloadFailed(error: NSError?) @@ -63,8 +63,8 @@ extension MASError: CustomStringConvertible { return "Sign in failed: \(error.localizedDescription)" } return "Sign in failed" - case .alreadySignedIn(let accountId): - return "Already signed in as \(accountId)" + case .alreadySignedIn(let appleID): + return "Already signed in as \(appleID)" case .purchaseFailed(let error): if let error { return "Download request failed: \(error.localizedDescription)" diff --git a/Tests/masTests/Errors/MASErrorTestCase.swift b/Tests/masTests/Errors/MASErrorTestCase.swift index 47c83d6..15cecfc 100644 --- a/Tests/masTests/Errors/MASErrorTestCase.swift +++ b/Tests/masTests/Errors/MASErrorTestCase.swift @@ -59,7 +59,7 @@ class MASErrorTestCase: XCTestCase { } func testAlreadySignedIn() { - error = .alreadySignedIn(asAccountId: "person@example.com") + error = .alreadySignedIn(asAppleID: "person@example.com") XCTAssertEqual(error.description, "Already signed in as person@example.com") }