fix indentation

This commit is contained in:
Dave Marquard 2021-07-19 13:07:57 -07:00
parent fef5be3d5e
commit 0c5917b4a2
No known key found for this signature in database
GPG Key ID: 46E688C4973F5C88
2 changed files with 66 additions and 66 deletions

View File

@ -1018,12 +1018,12 @@ private extension ReaderAPIAccountDelegate {
return nil return nil
} }
var authors: Set<ParsedAuthor>? { var authors: Set<ParsedAuthor>? {
guard let name = entry.author else { guard let name = entry.author else {
return nil return nil
} }
return Set([ParsedAuthor(name: name, url: nil, avatarURL: nil, emailAddress: nil)]) return Set([ParsedAuthor(name: name, url: nil, avatarURL: nil, emailAddress: nil)])
} }
return ParsedItem(syncServiceID: entry.uniqueID(variant: variant), return ParsedItem(syncServiceID: entry.uniqueID(variant: variant),
uniqueID: entry.uniqueID(variant: variant), uniqueID: entry.uniqueID(variant: variant),
@ -1039,7 +1039,7 @@ private extension ReaderAPIAccountDelegate {
bannerImageURL: nil, bannerImageURL: nil,
datePublished: entry.parseDatePublished(), datePublished: entry.parseDatePublished(),
dateModified: nil, dateModified: nil,
authors: authors, authors: authors,
tags: nil, tags: nil,
attachments: nil) attachments: nil)
} }

View File

@ -366,10 +366,10 @@ final class ReaderAPICaller: NSObject {
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST" request.httpMethod = "POST"
guard let encodedFeedURL = self.encodeForURLPath(url) else { guard let encodedFeedURL = self.encodeForURLPath(url) else {
completion(.failure(ReaderAPIAccountDelegateError.invalidParameter)) completion(.failure(ReaderAPIAccountDelegateError.invalidParameter))
return return
} }
let postData = "T=\(token)&quickadd=\(encodedFeedURL)".data(using: String.Encoding.utf8) let postData = "T=\(token)&quickadd=\(encodedFeedURL)".data(using: String.Encoding.utf8)
self.transport.send(request: request, method: HTTPMethod.post, data: postData!, resultType: ReaderAPIQuickAddResult.self, completion: { (result) in self.transport.send(request: request, method: HTTPMethod.post, data: postData!, resultType: ReaderAPIQuickAddResult.self, completion: { (result) in
@ -447,57 +447,57 @@ final class ReaderAPICaller: NSObject {
changeSubscription(subscriptionID: subscriptionID, removeTagName: tagName, completion: completion) changeSubscription(subscriptionID: subscriptionID, removeTagName: tagName, completion: completion)
} }
func moveSubscription(subscriptionID: String, fromTag: String, toTag: String, completion: @escaping (Result<Void, Error>) -> Void) { func moveSubscription(subscriptionID: String, fromTag: String, toTag: String, completion: @escaping (Result<Void, Error>) -> Void) {
changeSubscription(subscriptionID: subscriptionID, removeTagName: fromTag, addTagName: toTag, completion: completion) changeSubscription(subscriptionID: subscriptionID, removeTagName: fromTag, addTagName: toTag, completion: completion)
} }
private func changeSubscription(subscriptionID: String, removeTagName: String? = nil, addTagName: String? = nil, title: String? = nil, completion: @escaping (Result<Void, Error>) -> Void) { private func changeSubscription(subscriptionID: String, removeTagName: String? = nil, addTagName: String? = nil, title: String? = nil, completion: @escaping (Result<Void, Error>) -> Void) {
if removeTagName == nil && addTagName == nil && title == nil { if removeTagName == nil && addTagName == nil && title == nil {
completion(.failure(ReaderAPIAccountDelegateError.invalidParameter)) completion(.failure(ReaderAPIAccountDelegateError.invalidParameter))
return return
} }
guard let baseURL = apiBaseURL else { guard let baseURL = apiBaseURL else {
completion(.failure(CredentialsError.incompleteCredentials)) completion(.failure(CredentialsError.incompleteCredentials))
return return
} }
self.requestAuthorizationToken(endpoint: baseURL) { (result) in self.requestAuthorizationToken(endpoint: baseURL) { (result) in
switch result { switch result {
case .success(let token): case .success(let token):
var request = URLRequest(url: baseURL.appendingPathComponent(ReaderAPIEndpoints.subscriptionEdit.rawValue), credentials: self.credentials) var request = URLRequest(url: baseURL.appendingPathComponent(ReaderAPIEndpoints.subscriptionEdit.rawValue), credentials: self.credentials)
self.addVariantHeaders(&request) self.addVariantHeaders(&request)
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST" request.httpMethod = "POST"
var postString = "T=\(token)&s=\(subscriptionID)&ac=edit" var postString = "T=\(token)&s=\(subscriptionID)&ac=edit"
if let fromLabel = self.encodeForURLPath(removeTagName) { if let fromLabel = self.encodeForURLPath(removeTagName) {
postString += "&r=user/-/label/\(fromLabel)" postString += "&r=user/-/label/\(fromLabel)"
} }
if let toLabel = self.encodeForURLPath(addTagName) { if let toLabel = self.encodeForURLPath(addTagName) {
postString += "&a=user/-/label/\(toLabel)" postString += "&a=user/-/label/\(toLabel)"
} }
if let encodedTitle = self.encodeForURLPath(title) { if let encodedTitle = self.encodeForURLPath(title) {
postString += "&t=\(encodedTitle)" postString += "&t=\(encodedTitle)"
} }
let postData = postString.data(using: String.Encoding.utf8) let postData = postString.data(using: String.Encoding.utf8)
self.transport.send(request: request, method: HTTPMethod.post, payload: postData!, completion: { (result) in self.transport.send(request: request, method: HTTPMethod.post, payload: postData!, completion: { (result) in
switch result { switch result {
case .success: case .success:
completion(.success(())) completion(.success(()))
break break
case .failure(let error): case .failure(let error):
completion(.failure(error)) completion(.failure(error))
break break
} }
}) })
case .failure(let error): case .failure(let error):
completion(.failure(error)) completion(.failure(error))
} }
} }
} }
func retrieveEntries(articleIDs: [String], completion: @escaping (Result<([ReaderAPIEntry]?), Error>) -> Void) { func retrieveEntries(articleIDs: [String], completion: @escaping (Result<([ReaderAPIEntry]?), Error>) -> Void) {