mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
Remove unnecessary else
blocks.
Partial #592 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
71fbe2e444
commit
d7074db06f
3 changed files with 25 additions and 31 deletions
|
@ -25,9 +25,9 @@ extension ISStoreAccount: StoreAccount {
|
|||
Promise(error: MASError.notSignedIn)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
return .value(CKAccountStore.shared().primaryAccount)
|
||||
}
|
||||
|
||||
return .value(CKAccountStore.shared().primaryAccount)
|
||||
}
|
||||
|
||||
static func signIn(username: String, password: String, systemDialog: Bool) -> Promise<ISStoreAccount> {
|
||||
|
@ -70,20 +70,20 @@ extension ISStoreAccount: StoreAccount {
|
|||
|
||||
if systemDialog {
|
||||
return signInPromise
|
||||
} else {
|
||||
context.demoMode = true
|
||||
context.demoAccountName = username
|
||||
context.demoAccountPassword = password
|
||||
context.demoAutologinMode = true
|
||||
|
||||
return race(
|
||||
signInPromise,
|
||||
after(seconds: 30)
|
||||
.then {
|
||||
Promise(error: MASError.signInFailed(error: nil))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
context.demoMode = true
|
||||
context.demoAccountName = username
|
||||
context.demoAccountPassword = password
|
||||
context.demoAutologinMode = true
|
||||
|
||||
return race(
|
||||
signInPromise,
|
||||
after(seconds: 30)
|
||||
.then {
|
||||
Promise(error: MASError.signInFailed(error: nil))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,12 +60,12 @@ extension Mas {
|
|||
? appLibrary.installedApps
|
||||
: appIDs.compactMap {
|
||||
if let appID = AppID($0) {
|
||||
// if argument an AppID, lookup app by id using argument
|
||||
// argument is an AppID, lookup app by id using argument
|
||||
return appLibrary.installedApp(withAppID: appID)
|
||||
} else {
|
||||
// if argument not an AppID, lookup app by name using argument
|
||||
return appLibrary.installedApp(named: $0)
|
||||
}
|
||||
|
||||
// argument is not an AppID, lookup app by name using argument
|
||||
return appLibrary.installedApp(named: $0)
|
||||
}
|
||||
|
||||
let promises = apps.map { installedApp in
|
||||
|
|
|
@ -51,29 +51,25 @@ extension MASError: CustomStringConvertible {
|
|||
case .failed(let error):
|
||||
if let error {
|
||||
return "Failed: \(error.localizedDescription)"
|
||||
} else {
|
||||
return "Failed"
|
||||
}
|
||||
return "Failed"
|
||||
case .signInFailed(let error):
|
||||
if let error {
|
||||
return "Sign in failed: \(error.localizedDescription)"
|
||||
} else {
|
||||
return "Sign in failed"
|
||||
}
|
||||
return "Sign in failed"
|
||||
case .alreadySignedIn(let accountId):
|
||||
return "Already signed in as \(accountId)"
|
||||
case .purchaseFailed(let error):
|
||||
if let error {
|
||||
return "Download request failed: \(error.localizedDescription)"
|
||||
} else {
|
||||
return "Download request failed"
|
||||
}
|
||||
return "Download request failed"
|
||||
case .downloadFailed(let error):
|
||||
if let error {
|
||||
return "Download failed: \(error.localizedDescription)"
|
||||
} else {
|
||||
return "Download failed"
|
||||
}
|
||||
return "Download failed"
|
||||
case .noDownloads:
|
||||
return "No downloads began"
|
||||
case .cancelled:
|
||||
|
@ -94,12 +90,10 @@ extension MASError: CustomStringConvertible {
|
|||
if let data {
|
||||
if let unparsable = String(data: data, encoding: .utf8) {
|
||||
return "Unable to parse response as JSON: \n\(unparsable)"
|
||||
} else {
|
||||
return "Received defective response"
|
||||
}
|
||||
} else {
|
||||
return "Received empty response"
|
||||
return "Received defective response"
|
||||
}
|
||||
return "Received empty response"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue