Remove unnecessary else blocks.

Partial #592

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
Ross Goldberg 2024-10-21 07:29:13 -04:00
parent 71fbe2e444
commit d7074db06f
No known key found for this signature in database
3 changed files with 25 additions and 31 deletions

View file

@ -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,7 +70,8 @@ extension ISStoreAccount: StoreAccount {
if systemDialog {
return signInPromise
} else {
}
context.demoMode = true
context.demoAccountName = username
context.demoAccountPassword = password
@ -87,4 +88,3 @@ extension ISStoreAccount: StoreAccount {
}
}
}
}

View file

@ -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

View file

@ -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"
}
}
}
}