Fix lint issues.
This commit is contained in:
parent
d210692d7d
commit
72a5e46dcc
@ -8,7 +8,7 @@ let package = Package(
|
||||
products: [
|
||||
.library(
|
||||
name: "Parser",
|
||||
targets: ["Parser"]),
|
||||
targets: ["Parser"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(path: "../RSCore")
|
||||
@ -26,6 +26,6 @@ let package = Package(
|
||||
"Parser"
|
||||
],
|
||||
resources: [.copy("Resources")]
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
|
@ -160,7 +160,7 @@ private extension JSONFeedParser {
|
||||
let dateModified = parseDate(itemDictionary[Key.dateModified] as? String)
|
||||
|
||||
let authors = parseAuthors(itemDictionary)
|
||||
var tags: Set<String>? = nil
|
||||
var tags: Set<String>?
|
||||
if let tagsArray = itemDictionary[Key.tags] as? [String] {
|
||||
tags = Set(tagsArray)
|
||||
}
|
||||
|
@ -53,8 +53,7 @@ public struct RSSInJSONParser {
|
||||
|
||||
return ParsedFeed(type: .rssInJSON, title: title, homePageURL: homePageURL, feedURL: feedURL, language: feedLanguage, feedDescription: feedDescription, nextURL: nil, iconURL: nil, faviconURL: nil, authors: nil, expired: false, hubs: nil, items: items)
|
||||
|
||||
}
|
||||
catch { throw error }
|
||||
} catch { throw error }
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +73,7 @@ private extension RSSInJSONParser {
|
||||
let title = itemDictionary["title"] as? String
|
||||
|
||||
var contentHTML = itemDictionary["description"] as? String
|
||||
var contentText: String? = nil
|
||||
var contentText: String?
|
||||
if contentHTML != nil && !(contentHTML!.contains("<")) {
|
||||
contentText = contentHTML
|
||||
contentHTML = nil
|
||||
@ -83,7 +82,7 @@ private extension RSSInJSONParser {
|
||||
return nil
|
||||
}
|
||||
|
||||
var datePublished: Date? = nil
|
||||
var datePublished: Date?
|
||||
if let datePublishedString = itemDictionary["pubDate"] as? String {
|
||||
datePublished = DateParser.date(string: datePublishedString)
|
||||
}
|
||||
@ -150,8 +149,7 @@ private extension RSSInJSONParser {
|
||||
return Set([oneTag])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
else if let categoryArray = itemDictionary["category"] as? JSONArray {
|
||||
} else if let categoryArray = itemDictionary["category"] as? JSONArray {
|
||||
return Set(categoryArray.compactMap { $0["#value"] as? String })
|
||||
}
|
||||
return nil
|
||||
|
@ -39,17 +39,13 @@ public final class ParsedAuthor: Hashable, Codable, Sendable {
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
if let name {
|
||||
hasher.combine(name)
|
||||
}
|
||||
else if let url {
|
||||
} else if let url {
|
||||
hasher.combine(url)
|
||||
}
|
||||
else if let emailAddress {
|
||||
} else if let emailAddress {
|
||||
hasher.combine(emailAddress)
|
||||
}
|
||||
else if let avatarURL{
|
||||
} else if let avatarURL {
|
||||
hasher.combine(avatarURL)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
hasher.combine("")
|
||||
}
|
||||
}
|
||||
|
@ -57,8 +57,7 @@ public final class ParsedItem: Hashable, Sendable {
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
if let syncServiceID = syncServiceID {
|
||||
hasher.combine(syncServiceID)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
hasher.combine(uniqueID)
|
||||
hasher.combine(feedURL)
|
||||
}
|
||||
@ -69,4 +68,3 @@ public final class ParsedItem: Hashable, Sendable {
|
||||
lhs.syncServiceID == rhs.syncServiceID && lhs.uniqueID == rhs.uniqueID && lhs.feedURL == rhs.feedURL && lhs.url == rhs.url && lhs.externalURL == rhs.externalURL && lhs.title == rhs.title && lhs.language == rhs.language && lhs.contentHTML == rhs.contentHTML && lhs.contentText == rhs.contentText && lhs.summary == rhs.summary && lhs.imageURL == rhs.imageURL && lhs.bannerImageURL == rhs.bannerImageURL && lhs.datePublished == rhs.datePublished && lhs.dateModified == rhs.dateModified && lhs.authors == rhs.authors && lhs.tags == rhs.tags && lhs.attachments == rhs.attachments
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,29 +181,17 @@ private extension AtomParser {
|
||||
|
||||
if SAXEqualTags(localName, XMLName.id) {
|
||||
currentArticle.guid = currentString(saxParser)
|
||||
}
|
||||
|
||||
else if SAXEqualTags(localName, XMLName.title) {
|
||||
} else if SAXEqualTags(localName, XMLName.title) {
|
||||
currentArticle.title = currentString(saxParser)
|
||||
}
|
||||
|
||||
else if SAXEqualTags(localName, XMLName.content) {
|
||||
} else if SAXEqualTags(localName, XMLName.content) {
|
||||
addContent(saxParser, currentArticle)
|
||||
}
|
||||
|
||||
else if SAXEqualTags(localName, XMLName.summary) {
|
||||
} else if SAXEqualTags(localName, XMLName.summary) {
|
||||
addSummary(saxParser, currentArticle)
|
||||
}
|
||||
|
||||
else if SAXEqualTags(localName, XMLName.link) {
|
||||
} else if SAXEqualTags(localName, XMLName.link) {
|
||||
addLink(currentArticle)
|
||||
}
|
||||
|
||||
else if SAXEqualTags(localName, XMLName.published) {
|
||||
} else if SAXEqualTags(localName, XMLName.published) {
|
||||
currentArticle.datePublished = currentDate(saxParser)
|
||||
}
|
||||
|
||||
else if SAXEqualTags(localName, XMLName.updated) {
|
||||
} else if SAXEqualTags(localName, XMLName.updated) {
|
||||
currentArticle.dateModified = currentDate(saxParser)
|
||||
}
|
||||
|
||||
@ -212,8 +200,7 @@ private extension AtomParser {
|
||||
if currentArticle.datePublished == nil {
|
||||
currentArticle.datePublished = currentDate(saxParser)
|
||||
}
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.modified) {
|
||||
} else if SAXEqualTags(localName, XMLName.modified) {
|
||||
if currentArticle.dateModified == nil {
|
||||
currentArticle.dateModified = currentDate(saxParser)
|
||||
}
|
||||
@ -258,13 +245,11 @@ private extension AtomParser {
|
||||
if article.link == nil {
|
||||
article.link = resolvedURLString
|
||||
}
|
||||
}
|
||||
else if rel == AttributeValue.alternate {
|
||||
} else if rel == AttributeValue.alternate {
|
||||
if article.permalink == nil {
|
||||
article.permalink = resolvedURLString
|
||||
}
|
||||
}
|
||||
else if rel == AttributeValue.enclosure {
|
||||
} else if rel == AttributeValue.enclosure {
|
||||
if let enclosure = enclosure(resolvedURLString, attributes) {
|
||||
article.addEnclosure(enclosure)
|
||||
}
|
||||
@ -372,7 +357,7 @@ extension AtomParser: SAXParserDelegate {
|
||||
currentArticle?.language = xmlAttributes["xml:lang"]
|
||||
}
|
||||
|
||||
let contentType = xmlAttributes["type"];
|
||||
let contentType = xmlAttributes["type"]
|
||||
if contentType == "xhtml" {
|
||||
parsingXHTML = true
|
||||
xhtmlString = ""
|
||||
@ -416,9 +401,7 @@ extension AtomParser: SAXParserDelegate {
|
||||
|
||||
if isContentTag {
|
||||
currentArticle?.body = xhtmlString
|
||||
}
|
||||
|
||||
else if isSummaryTag {
|
||||
} else if isSummaryTag {
|
||||
if (currentArticle?.body?.count ?? 0) < 1 {
|
||||
currentArticle?.body = xhtmlString
|
||||
}
|
||||
@ -438,9 +421,7 @@ extension AtomParser: SAXParserDelegate {
|
||||
} else {
|
||||
assertionFailure("xhtmlString must not be nil when parsingXHTML in xmlEndElement.")
|
||||
}
|
||||
}
|
||||
|
||||
else if parsingAuthor {
|
||||
} else if parsingAuthor {
|
||||
|
||||
if SAXEqualTags(localName, XMLName.author) {
|
||||
parsingAuthor = false
|
||||
@ -448,32 +429,21 @@ extension AtomParser: SAXParserDelegate {
|
||||
currentArticle?.addAuthor(currentAuthor)
|
||||
}
|
||||
currentAuthor = nil
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.name) {
|
||||
} else if SAXEqualTags(localName, XMLName.name) {
|
||||
currentAuthor?.name = saxParser.currentStringWithTrimmedWhitespace
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.email) {
|
||||
} else if SAXEqualTags(localName, XMLName.email) {
|
||||
currentAuthor?.emailAddress = saxParser.currentStringWithTrimmedWhitespace
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.uri) {
|
||||
} else if SAXEqualTags(localName, XMLName.uri) {
|
||||
currentAuthor?.url = saxParser.currentStringWithTrimmedWhitespace
|
||||
}
|
||||
}
|
||||
|
||||
else if SAXEqualTags(localName, XMLName.entry) {
|
||||
} else if SAXEqualTags(localName, XMLName.entry) {
|
||||
parsingArticle = false
|
||||
entryDepth = -1
|
||||
}
|
||||
|
||||
else if parsingArticle && !parsingSource && depth == entryDepth + 1 {
|
||||
} else if parsingArticle && !parsingSource && depth == entryDepth + 1 {
|
||||
addArticleElement(saxParser, localName, prefix)
|
||||
}
|
||||
|
||||
else if SAXEqualTags(localName, XMLName.source) {
|
||||
} else if SAXEqualTags(localName, XMLName.source) {
|
||||
parsingSource = false
|
||||
}
|
||||
|
||||
else if !parsingArticle && !parsingSource && SAXEqualTags(localName, XMLName.title) {
|
||||
} else if !parsingArticle && !parsingSource && SAXEqualTags(localName, XMLName.title) {
|
||||
addFeedTitle(saxParser)
|
||||
}
|
||||
|
||||
|
@ -81,28 +81,21 @@ private extension RSSArticle {
|
||||
if let permalink, !permalink.isEmpty, let datePublishedTimeStampString {
|
||||
s.append(permalink)
|
||||
s.append(datePublishedTimeStampString)
|
||||
}
|
||||
else if let link, !link.isEmpty, let datePublishedTimeStampString {
|
||||
} else if let link, !link.isEmpty, let datePublishedTimeStampString {
|
||||
s.append(link)
|
||||
s.append(datePublishedTimeStampString)
|
||||
}
|
||||
else if let title, !title.isEmpty, let datePublishedTimeStampString {
|
||||
} else if let title, !title.isEmpty, let datePublishedTimeStampString {
|
||||
s.append(title)
|
||||
s.append(datePublishedTimeStampString)
|
||||
}
|
||||
else if let datePublishedTimeStampString {
|
||||
} else if let datePublishedTimeStampString {
|
||||
s.append(datePublishedTimeStampString)
|
||||
}
|
||||
else if let permalink, !permalink.isEmpty {
|
||||
} else if let permalink, !permalink.isEmpty {
|
||||
s.append(permalink)
|
||||
}
|
||||
else if let link, !link.isEmpty {
|
||||
} else if let link, !link.isEmpty {
|
||||
s.append(link)
|
||||
}
|
||||
else if let title, !title.isEmpty {
|
||||
} else if let title, !title.isEmpty {
|
||||
s.append(title)
|
||||
}
|
||||
else if let body, !body.isEmpty {
|
||||
} else if let body, !body.isEmpty {
|
||||
s.append(body)
|
||||
}
|
||||
|
||||
|
@ -79,11 +79,9 @@ private extension RSSParser {
|
||||
if feed.link == nil {
|
||||
feed.link = saxParser.currentString
|
||||
}
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.title) {
|
||||
} else if SAXEqualTags(localName, XMLName.title) {
|
||||
feed.title = saxParser.currentString
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.language) {
|
||||
} else if SAXEqualTags(localName, XMLName.language) {
|
||||
feed.language = saxParser.currentString
|
||||
}
|
||||
}
|
||||
@ -118,26 +116,20 @@ private extension RSSParser {
|
||||
if let currentString = saxParser.currentString {
|
||||
if SAXEqualTags(localName, XMLName.guid) {
|
||||
addGuid(currentString, currentArticle)
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.author) {
|
||||
} else if SAXEqualTags(localName, XMLName.author) {
|
||||
addAuthorWithString(currentString, currentArticle)
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.link) {
|
||||
} else if SAXEqualTags(localName, XMLName.link) {
|
||||
currentArticle.link = urlString(currentString)
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.description) {
|
||||
} else if SAXEqualTags(localName, XMLName.description) {
|
||||
if currentArticle.body == nil {
|
||||
currentArticle.body = currentString
|
||||
}
|
||||
}
|
||||
else if !parsingAuthor && SAXEqualTags(localName, XMLName.title) {
|
||||
} else if !parsingAuthor && SAXEqualTags(localName, XMLName.title) {
|
||||
currentArticle.title = currentString
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.pubDate) {
|
||||
} else if SAXEqualTags(localName, XMLName.pubDate) {
|
||||
currentArticle.datePublished = currentDate(saxParser)
|
||||
}
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.enclosure), let currentAttributes {
|
||||
} else if SAXEqualTags(localName, XMLName.enclosure), let currentAttributes {
|
||||
addEnclosure(currentAttributes, currentArticle)
|
||||
}
|
||||
}
|
||||
@ -148,8 +140,7 @@ private extension RSSParser {
|
||||
if let currentString = saxParser.currentString {
|
||||
addAuthorWithString(currentString, currentArticle)
|
||||
}
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.date) {
|
||||
} else if SAXEqualTags(localName, XMLName.date) {
|
||||
currentArticle.datePublished = currentDate(saxParser)
|
||||
}
|
||||
}
|
||||
@ -298,7 +289,7 @@ extension RSSParser: SAXParserDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
var xmlAttributes: StringDictionary? = nil
|
||||
var xmlAttributes: StringDictionary?
|
||||
if (isRDF && SAXEqualTags(localName, XMLName.item)) || SAXEqualTags(localName, XMLName.guid) || SAXEqualTags(localName, XMLName.enclosure) {
|
||||
xmlAttributes = saxParser.attributesDictionary(attributes, attributeCount: attributeCount)
|
||||
}
|
||||
@ -314,11 +305,9 @@ extension RSSParser: SAXParserDelegate {
|
||||
currentArticle.guid = rdfGuid
|
||||
currentArticle.permalink = rdfGuid
|
||||
}
|
||||
}
|
||||
else if prefix == nil && SAXEqualTags(localName, XMLName.image) {
|
||||
} else if prefix == nil && SAXEqualTags(localName, XMLName.image) {
|
||||
parsingChannelImage = true
|
||||
}
|
||||
else if prefix == nil && SAXEqualTags(localName, XMLName.author) {
|
||||
} else if prefix == nil && SAXEqualTags(localName, XMLName.author) {
|
||||
if parsingArticle {
|
||||
parsingAuthor = true
|
||||
}
|
||||
@ -337,23 +326,18 @@ extension RSSParser: SAXParserDelegate {
|
||||
|
||||
if isRDF && SAXEqualTags(localName, XMLName.uppercaseRDF) {
|
||||
endRSSFound = true
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.rss) {
|
||||
} else if SAXEqualTags(localName, XMLName.rss) {
|
||||
endRSSFound = true
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.image) {
|
||||
} else if SAXEqualTags(localName, XMLName.image) {
|
||||
parsingChannelImage = false
|
||||
}
|
||||
else if SAXEqualTags(localName, XMLName.item) {
|
||||
} else if SAXEqualTags(localName, XMLName.item) {
|
||||
parsingArticle = false
|
||||
}
|
||||
else if parsingArticle {
|
||||
} else if parsingArticle {
|
||||
addArticleElement(saxParser, localName, prefix)
|
||||
if SAXEqualTags(localName, XMLName.author) {
|
||||
parsingAuthor = false
|
||||
}
|
||||
}
|
||||
else if !parsingChannelImage {
|
||||
} else if !parsingChannelImage {
|
||||
addFeedElement(saxParser, localName, prefix)
|
||||
}
|
||||
}
|
||||
@ -363,4 +347,3 @@ extension RSSParser: SAXParserDelegate {
|
||||
// Required method.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ private func decodedEntities(_ sourceBuffer: UnsafeBufferPointer<UInt8>, _ didDe
|
||||
|
||||
let ch = sourceBuffer[sourceLocation]
|
||||
|
||||
var decodedEntity: String? = nil
|
||||
var decodedEntity: String?
|
||||
|
||||
if ch == ampersandCharacter {
|
||||
decodedEntity = decodedEntityValue(sourceBuffer, byteCount, &sourceLocation)
|
||||
@ -112,7 +112,7 @@ private func addDecodedEntity(_ decodedEntity: String, _ result: UnsafeMutablePo
|
||||
}
|
||||
}
|
||||
|
||||
private func decodedEntityValue(_ buffer: UnsafeBufferPointer<UInt8>, _ byteCount: Int, _ sourceLocation: inout Int) -> /*[UInt8]?*/ String? {
|
||||
private func decodedEntityValue(_ buffer: UnsafeBufferPointer<UInt8>, _ byteCount: Int, _ sourceLocation: inout Int) -> String? {
|
||||
|
||||
guard let rawEntity = rawEntityValue(buffer, byteCount, &sourceLocation) else {
|
||||
return nil
|
||||
@ -153,8 +153,7 @@ private func decodedNumericEntity(_ rawEntity: ContiguousArray<UInt8>) -> String
|
||||
|
||||
if rawEntity[1] == xCharacter || rawEntity[1] == XCharacter { // Hex?
|
||||
decodedNumber = decodedHexEntity(rawEntity)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
decodedNumber = decodedDecimalEntity(rawEntity)
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,7 @@ public final class HTMLMetadata: Sendable {
|
||||
self.appleTouchIcons = appleTouchIconTags.map { htmlTag in
|
||||
HTMLMetadataAppleTouchIcon(urlString, htmlTag)
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
self.appleTouchIcons = nil
|
||||
}
|
||||
|
||||
@ -37,8 +36,7 @@ public final class HTMLMetadata: Sendable {
|
||||
self.feedLinks = feedLinkTags.map { htmlTag in
|
||||
HTMLMetadataFeedLink(urlString, htmlTag)
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
self.feedLinks = nil
|
||||
}
|
||||
|
||||
@ -206,8 +204,7 @@ public final class HTMLMetadataAppleTouchIcon: Sendable {
|
||||
let sizeComponents = sizes.components(separatedBy: CharacterSet(charactersIn: "x"))
|
||||
if sizeComponents.count == 2, let width = Double(sizeComponents[0]), let height = Double(sizeComponents[1]) {
|
||||
self.size = CGSize(width: width, height: height)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
self.size = nil
|
||||
}
|
||||
}
|
||||
@ -313,25 +310,19 @@ private extension HTMLOpenGraphProperties {
|
||||
|
||||
if propertyName == OGValue.ogImage {
|
||||
url = content
|
||||
}
|
||||
else if propertyName == OGValue.ogImageURL {
|
||||
} else if propertyName == OGValue.ogImageURL {
|
||||
url = content
|
||||
}
|
||||
else if propertyName == OGValue.ogImageSecureURL {
|
||||
} else if propertyName == OGValue.ogImageSecureURL {
|
||||
secureURL = content
|
||||
}
|
||||
else if propertyName == OGValue.ogImageType {
|
||||
} else if propertyName == OGValue.ogImageType {
|
||||
mimeType = content
|
||||
}
|
||||
else if propertyName == OGValue.ogImageAlt {
|
||||
} else if propertyName == OGValue.ogImageAlt {
|
||||
altText = content
|
||||
}
|
||||
else if propertyName == OGValue.ogImageWidth {
|
||||
} else if propertyName == OGValue.ogImageWidth {
|
||||
if let value = Double(content) {
|
||||
width = CGFloat(value)
|
||||
}
|
||||
}
|
||||
else if propertyName == OGValue.ogImageHeight {
|
||||
} else if propertyName == OGValue.ogImageHeight {
|
||||
if let value = Double(content) {
|
||||
height = CGFloat(value)
|
||||
}
|
||||
@ -434,4 +425,3 @@ private func absoluteURLStringWithRelativeURLString(_ relativeURLString: String,
|
||||
}
|
||||
return absoluteURL.absoluteURL.standardized.absoluteString
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,7 @@ extension HTMLMetadataParser: SAXHTMLParserDelegate {
|
||||
if let d, !d.isEmpty {
|
||||
handleLinkAttributes(d)
|
||||
}
|
||||
}
|
||||
else if SAXEqualTags(name, HTMLName.meta) {
|
||||
} else if SAXEqualTags(name, HTMLName.meta) {
|
||||
let d = saxHTMLParser.attributesDictionary(attributes)
|
||||
if let d, !d.isEmpty {
|
||||
handleMetaAttributes(d)
|
||||
|
@ -9,8 +9,8 @@ import Foundation
|
||||
|
||||
public final class OPMLDocument: OPMLItem {
|
||||
|
||||
public var title: String? = nil
|
||||
public var url: String? = nil
|
||||
public var title: String?
|
||||
public var url: String?
|
||||
|
||||
init(url: String?) {
|
||||
self.url = url
|
||||
|
@ -37,4 +37,3 @@ public struct OPMLFeedSpecifier: Sendable {
|
||||
self.feedURL = feedURL
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public final class SAXHTMLParser {
|
||||
|
||||
var dictionary = [String: String]()
|
||||
var ix = 0
|
||||
var currentKey: String? = nil
|
||||
var currentKey: String?
|
||||
|
||||
while true {
|
||||
let oneAttribute = attributes[ix]
|
||||
|
@ -201,4 +201,3 @@ nonisolated(unsafe) private var saxHandlerStruct: xmlSAXHandler = {
|
||||
|
||||
return handler
|
||||
}()
|
||||
|
||||
|
@ -10,7 +10,7 @@ import libxml2
|
||||
|
||||
public func SAXEqualTags(_ localName: XMLPointer, _ tag: ContiguousArray<Int8>) -> Bool {
|
||||
|
||||
return tag.withUnsafeBufferPointer { bufferPointer in
|
||||
return tag.withUnsafeBufferPointer { _ in
|
||||
|
||||
let tagCount = tag.count // includes 0 terminator
|
||||
|
||||
|
@ -16,7 +16,7 @@ final class AtomParserTests: XCTestCase {
|
||||
// 0.009 sec on my 2012 iMac.
|
||||
let d = parserData("DaringFireball", "atom", "http://daringfireball.net/") // It’s actually an Atom feed
|
||||
self.measure {
|
||||
let _ = try! FeedParser.parse(d)
|
||||
_ = try! FeedParser.parse(d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,8 +35,7 @@ final class AtomParserTests: XCTestCase {
|
||||
let author = article.authors!.first!
|
||||
if author.name == "Daring Fireball Department of Commerce" {
|
||||
XCTAssertNil(author.url)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
XCTAssertEqual(author.name, "John Gruber")
|
||||
XCTAssertEqual(author.url, "http://daringfireball.net/")
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ final class FeedParserTypeTests: XCTestCase {
|
||||
|
||||
let d = parserData("EMarley", "rss", "https://medium.com/@emarley")
|
||||
self.measure {
|
||||
let _ = FeedType.feedType(d.data)
|
||||
_ = FeedType.feedType(d.data)
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ final class FeedParserTypeTests: XCTestCase {
|
||||
|
||||
let d = parserData("inessential", "json", "http://inessential.com/")
|
||||
self.measure {
|
||||
let _ = FeedType.feedType(d.data)
|
||||
_ = FeedType.feedType(d.data)
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ final class FeedParserTypeTests: XCTestCase {
|
||||
|
||||
let d = parserData("DaringFireball", "html", "http://daringfireball.net/")
|
||||
self.measure {
|
||||
let _ = FeedType.feedType(d.data)
|
||||
_ = FeedType.feedType(d.data)
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ final class FeedParserTypeTests: XCTestCase {
|
||||
|
||||
let d = parserData("DaringFireball", "rss", "http://daringfireball.net/")
|
||||
self.measure {
|
||||
let _ = FeedType.feedType(d.data)
|
||||
_ = FeedType.feedType(d.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ final class HTMLLinkTests: XCTestCase {
|
||||
// 0.003 sec on my 2012 iMac
|
||||
let d = parserData("sixcolors", "html", "http://sixcolors.com/")
|
||||
self.measure {
|
||||
let _ = HTMLLinkParser.htmlLinks(with: d)
|
||||
_ = HTMLLinkParser.htmlLinks(with: d)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ final class HTMLMetadataTests: XCTestCase {
|
||||
// 0.002 sec on my 2012 iMac
|
||||
let d = parserData("DaringFireball", "html", "http://daringfireball.net/")
|
||||
self.measure {
|
||||
let _ = HTMLMetadataParser.metadata(with: d)
|
||||
_ = HTMLMetadataParser.metadata(with: d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ final class HTMLMetadataTests: XCTestCase {
|
||||
// 0.001 sec on my 2012 iMac
|
||||
let d = parserData("furbo", "html", "http://furbo.org/")
|
||||
self.measure {
|
||||
let _ = HTMLMetadataParser.metadata(with: d)
|
||||
_ = HTMLMetadataParser.metadata(with: d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ final class HTMLMetadataTests: XCTestCase {
|
||||
XCTAssertEqual(feedLink.type, "application/rss+xml")
|
||||
XCTAssertEqual(feedLink.urlString, "http://inessential.com/xml/rss.xml")
|
||||
|
||||
XCTAssertEqual(metadata.appleTouchIcons?.count ?? 0, 0);
|
||||
XCTAssertEqual(metadata.appleTouchIcons?.count ?? 0, 0)
|
||||
}
|
||||
|
||||
func testInessentialPerformance() {
|
||||
@ -79,7 +79,7 @@ final class HTMLMetadataTests: XCTestCase {
|
||||
// 0.001 sec on my 2012 iMac
|
||||
let d = parserData("inessential", "html", "http://inessential.com/")
|
||||
self.measure {
|
||||
let _ = HTMLMetadataParser.metadata(with: d)
|
||||
_ = HTMLMetadataParser.metadata(with: d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ final class HTMLMetadataTests: XCTestCase {
|
||||
// 0.004 sec on my 2012 iMac
|
||||
let d = parserData("coco", "html", "https://www.theatlantic.com/entertainment/archive/2017/11/coco-is-among-pixars-best-movies-in-years/546695/")
|
||||
self.measure {
|
||||
let _ = HTMLMetadataParser.metadata(with: d)
|
||||
_ = HTMLMetadataParser.metadata(with: d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,17 +99,17 @@ final class HTMLMetadataTests: XCTestCase {
|
||||
|
||||
XCTAssertEqual(metadata.favicons?.first?.urlString, "https://sixcolors.com/images/favicon.ico")
|
||||
|
||||
XCTAssertEqual(metadata.feedLinks?.count, 1);
|
||||
XCTAssertEqual(metadata.feedLinks?.count, 1)
|
||||
let feedLink = (metadata.feedLinks?.first!)!
|
||||
XCTAssertEqual(feedLink.title, "RSS");
|
||||
XCTAssertEqual(feedLink.type, "application/rss+xml");
|
||||
XCTAssertEqual(feedLink.urlString, "http://feedpress.me/sixcolors");
|
||||
XCTAssertEqual(feedLink.title, "RSS")
|
||||
XCTAssertEqual(feedLink.type, "application/rss+xml")
|
||||
XCTAssertEqual(feedLink.urlString, "http://feedpress.me/sixcolors")
|
||||
|
||||
XCTAssertEqual(metadata.appleTouchIcons!.count, 6);
|
||||
let icon = metadata.appleTouchIcons![3];
|
||||
XCTAssertEqual(icon.rel, "apple-touch-icon");
|
||||
XCTAssertEqual(icon.sizes, "120x120");
|
||||
XCTAssertEqual(icon.urlString, "https://sixcolors.com/apple-touch-icon-120.png");
|
||||
XCTAssertEqual(metadata.appleTouchIcons!.count, 6)
|
||||
let icon = metadata.appleTouchIcons![3]
|
||||
XCTAssertEqual(icon.rel, "apple-touch-icon")
|
||||
XCTAssertEqual(icon.sizes, "120x120")
|
||||
XCTAssertEqual(icon.urlString, "https://sixcolors.com/apple-touch-icon-120.png")
|
||||
}
|
||||
|
||||
func testSixColorsPerformance() {
|
||||
@ -117,7 +117,7 @@ final class HTMLMetadataTests: XCTestCase {
|
||||
// 0.002 sec on my 2012 iMac
|
||||
let d = parserData("sixcolors", "html", "http://sixcolors.com/")
|
||||
self.measure {
|
||||
let _ = HTMLMetadataParser.metadata(with: d)
|
||||
_ = HTMLMetadataParser.metadata(with: d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,10 +144,10 @@ final class HTMLMetadataTests: XCTestCase {
|
||||
let d = parserData("YouTubeTheVolvoRocks", "html", "https://www.youtube.com/user/TheVolvorocks")
|
||||
let metadata = HTMLMetadataParser.metadata(with: d)
|
||||
|
||||
XCTAssertEqual(metadata.feedLinks!.count, 1);
|
||||
XCTAssertEqual(metadata.feedLinks!.count, 1)
|
||||
let feedLink = metadata.feedLinks!.first!
|
||||
XCTAssertEqual(feedLink.title, "RSS");
|
||||
XCTAssertEqual(feedLink.type, "application/rss+xml");
|
||||
XCTAssertEqual(feedLink.urlString, "https://www.youtube.com/feeds/videos.xml?channel_id=UCct7QF2jcWRY6dhXWMSq9LQ");
|
||||
XCTAssertEqual(feedLink.title, "RSS")
|
||||
XCTAssertEqual(feedLink.type, "application/rss+xml")
|
||||
XCTAssertEqual(feedLink.urlString, "https://www.youtube.com/feeds/videos.xml?channel_id=UCct7QF2jcWRY6dhXWMSq9LQ")
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ final class JSONFeedParserTests: XCTestCase {
|
||||
// 0.001 sec on my 2012 iMac.
|
||||
let d = parserData("inessential", "json", "http://inessential.com/")
|
||||
self.measure {
|
||||
let _ = try! FeedParser.parse(d)
|
||||
_ = try! FeedParser.parse(d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ final class JSONFeedParserTests: XCTestCase {
|
||||
// 0.009 sec on my 2012 iMac.
|
||||
let d = parserData("DaringFireball", "json", "http://daringfireball.net/")
|
||||
self.measure {
|
||||
let _ = try! FeedParser.parse(d)
|
||||
_ = try! FeedParser.parse(d)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ final class OPMLTests: XCTestCase {
|
||||
|
||||
// 0.003 sec on my M1 Mac Studio 2022
|
||||
self.measure {
|
||||
let _ = OPMLParser.document(with: self.subsData)
|
||||
_ = OPMLParser.document(with: self.subsData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +36,6 @@ final class OPMLTests: XCTestCase {
|
||||
recursivelyCheckOPMLStructure(opmlDocument!)
|
||||
}
|
||||
|
||||
|
||||
func testFindingTitles() {
|
||||
// https://github.com/brentsimmons/NetNewsWire/issues/527
|
||||
// Fix a bug where titles aren’t found when there’s no title attribute in the OPML,
|
||||
@ -66,8 +65,7 @@ private extension OPMLTests {
|
||||
if !isFolder {
|
||||
XCTAssertNotNil(feedSpecifier!.title)
|
||||
XCTAssertNotNil(feedSpecifier!.feedURL)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
XCTAssertNil(feedSpecifier)
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ final class RSSInJSONParserTests: XCTestCase {
|
||||
// 0.003 sec on my 2012 iMac.
|
||||
let d = parserData("ScriptingNews", "json", "http://scripting.com/")
|
||||
self.measure {
|
||||
let _ = try! FeedParser.parse(d)
|
||||
_ = try! FeedParser.parse(d)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ final class RSSParserTests: XCTestCase {
|
||||
// 0.002 2022 Mac Studio
|
||||
let d = parserData("scriptingNews", "rss", "http://scripting.com/")
|
||||
self.measure {
|
||||
let _ = try! FeedParser.parse(d)
|
||||
_ = try! FeedParser.parse(d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ final class RSSParserTests: XCTestCase {
|
||||
// 0.001 2022 Mac Studio
|
||||
let d = parserData("KatieFloyd", "rss", "http://katiefloyd.com/")
|
||||
self.measure {
|
||||
let _ = try! FeedParser.parse(d)
|
||||
_ = try! FeedParser.parse(d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ final class RSSParserTests: XCTestCase {
|
||||
// 0.0004 2022 Mac Studio
|
||||
let d = parserData("EMarley", "rss", "https://medium.com/@emarley")
|
||||
self.measure {
|
||||
let _ = try! FeedParser.parse(d)
|
||||
_ = try! FeedParser.parse(d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ final class RSSParserTests: XCTestCase {
|
||||
// 0.0006 2022 Mac Studio
|
||||
let d = parserData("manton", "rss", "http://manton.org/")
|
||||
self.measure {
|
||||
let _ = try! FeedParser.parse(d)
|
||||
_ = try! FeedParser.parse(d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ final class RSSParserTests: XCTestCase {
|
||||
// 0.002 2022 Mac Studio
|
||||
let d = parserData("allthis", "rss", "http://leancrew.com/all-this")
|
||||
self.measure {
|
||||
let _ = try! FeedParser.parse(d)
|
||||
_ = try! FeedParser.parse(d)
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,8 +241,7 @@ final class RSSParserTests: XCTestCase {
|
||||
// Tue, 07 Mar 2023 15:15:29 -0500
|
||||
let expectedDatePublished = dateWithValues(2023, 3, 7, 20, 15, 29)
|
||||
XCTAssertEqual(article.datePublished, expectedDatePublished)
|
||||
}
|
||||
else if article.title == "Ventura’s System Settings" {
|
||||
} else if article.title == "Ventura’s System Settings" {
|
||||
didFindSecondTestArticle = true
|
||||
// Sun, 30 Oct 2022 11:58:26 -0500
|
||||
let expectedDatePublished = dateWithValues(2022, 10, 30, 16, 58, 26)
|
||||
|
@ -21,6 +21,6 @@ let package = Package(
|
||||
]),
|
||||
.testTarget(
|
||||
name: "RSCoreTests",
|
||||
dependencies: ["RSCore"]),
|
||||
dependencies: ["RSCore"])
|
||||
]
|
||||
)
|
||||
|
@ -34,4 +34,3 @@ public extension Int {
|
||||
return UInt32(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public struct KeyboardKey: Hashable {
|
||||
|
||||
var integerValue = 0
|
||||
|
||||
switch(s) {
|
||||
switch s {
|
||||
case "[space]":
|
||||
integerValue = " ".keyboardIntegerValue!
|
||||
case "[uparrow]":
|
||||
|
@ -69,8 +69,7 @@ public extension NSOutlineView {
|
||||
selectRowAndScrollToVisible(row)
|
||||
return
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return // if there are no more items, we’re out of rows
|
||||
}
|
||||
}
|
||||
@ -180,4 +179,3 @@ public extension NSOutlineView {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -13,14 +13,13 @@ public extension NSResponder {
|
||||
func hasAncestor(_ ancestor: NSResponder) -> Bool {
|
||||
|
||||
var nomad: NSResponder = self
|
||||
while(true) {
|
||||
while true {
|
||||
if nomad === ancestor {
|
||||
return true
|
||||
}
|
||||
if let _ = nomad.nextResponder {
|
||||
nomad = nomad.nextResponder!
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -43,12 +43,12 @@ public extension NSTableView {
|
||||
let documentVisibleRect = scrollView.documentVisibleRect
|
||||
|
||||
let r = rect(ofRow: row)
|
||||
if NSContainsRect(documentVisibleRect, r) {
|
||||
if documentVisibleRect.contains(r) {
|
||||
return
|
||||
}
|
||||
|
||||
let rMidY = NSMidY(r)
|
||||
var scrollPoint = NSZeroPoint;
|
||||
let rMidY = r.midY
|
||||
var scrollPoint = NSPoint.zero
|
||||
scrollPoint.y = floor(rMidY - (documentVisibleRect.size.height / 2.0)) + CGFloat(extraHeight)
|
||||
scrollPoint.y = max(scrollPoint.y, 0)
|
||||
|
||||
@ -57,7 +57,7 @@ public extension NSTableView {
|
||||
|
||||
let clipView = scrollView.contentView
|
||||
|
||||
let rClipView = NSMakeRect(scrollPoint.x, scrollPoint.y, NSWidth(clipView.bounds), NSHeight(clipView.bounds))
|
||||
let rClipView = NSRect(x: scrollPoint.x, y: scrollPoint.y, width: clipView.bounds.width, height: clipView.bounds.height)
|
||||
|
||||
clipView.animator().bounds = rClipView
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ public class RSAppMovementMonitor: NSObject {
|
||||
|
||||
// If provided, the handler will be consulted when the app is moved.
|
||||
// Return true to indicate that the default handler should be invoked.
|
||||
public var appMovementHandler: ((RSAppMovementMonitor) -> Bool)? = nil
|
||||
public var appMovementHandler: ((RSAppMovementMonitor) -> Bool)?
|
||||
|
||||
// DispatchSource offers a monitoring mechanism based on an open file descriptor
|
||||
var fileDescriptor: Int32 = -1
|
||||
var dispatchSource: DispatchSourceFileSystemObject? = nil
|
||||
var dispatchSource: DispatchSourceFileSystemObject?
|
||||
|
||||
// Save the original location of the app in a file reference URL, which will track its new location.
|
||||
// Note this is NSURL, not URL, because file reference URLs violate value-type assumptions of URL.
|
||||
@ -77,7 +77,7 @@ public class RSAppMovementMonitor: NSObject {
|
||||
// every time the app becomes active. This catches a good number of edge-case
|
||||
// changes to the app bundle's path, such as when a containing folder or the
|
||||
// volume name changes.
|
||||
NotificationCenter.default.addObserver(forName: NSApplication.didBecomeActiveNotification, object: nil, queue: nil) { notification in
|
||||
NotificationCenter.default.addObserver(forName: NSApplication.didBecomeActiveNotification, object: nil, queue: nil) { _ in
|
||||
// Removing observer in invalidate doesn't seem to prevent this getting called? Maybe
|
||||
// because it's on the same invocation of the runloop?
|
||||
if self.isValid() && self.originalAppURL != self.appTrackingURL?.absoluteURL {
|
||||
|
@ -35,7 +35,7 @@ private extension RSToolbarItem {
|
||||
return false
|
||||
}
|
||||
|
||||
while(true) {
|
||||
while true {
|
||||
if let validated = validateWithResponder(responder!) {
|
||||
return validated
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import AppKit
|
||||
public final class UserApp {
|
||||
|
||||
public let bundleID: String
|
||||
public var icon: NSImage? = nil
|
||||
public var icon: NSImage?
|
||||
public var existsOnDisk = false
|
||||
public var path: String? = nil
|
||||
public var runningApplication: NSRunningApplication? = nil
|
||||
public var path: String?
|
||||
public var runningApplication: NSRunningApplication?
|
||||
|
||||
public var isRunning: Bool {
|
||||
|
||||
@ -47,8 +47,7 @@ public final class UserApp {
|
||||
if app == runningApplication {
|
||||
break
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if !app.isTerminated {
|
||||
runningApplication = app
|
||||
break
|
||||
@ -61,8 +60,7 @@ public final class UserApp {
|
||||
icon = runningApplication.icon
|
||||
if let bundleURL = runningApplication.bundleURL {
|
||||
path = bundleURL.path
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
path = NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleID)?.path
|
||||
}
|
||||
if icon == nil, let path = path {
|
||||
@ -77,8 +75,7 @@ public final class UserApp {
|
||||
icon = NSWorkspace.shared.icon(forFile: path)
|
||||
}
|
||||
existsOnDisk = true
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
existsOnDisk = false
|
||||
icon = nil
|
||||
}
|
||||
@ -146,4 +143,3 @@ public final class UserApp {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -39,8 +39,7 @@ public struct BinaryDiskCache {
|
||||
get {
|
||||
do {
|
||||
return try data(forKey: key)
|
||||
}
|
||||
catch {}
|
||||
} catch {}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -48,14 +47,11 @@ public struct BinaryDiskCache {
|
||||
if let data = newValue {
|
||||
do {
|
||||
try setData(data, forKey: key)
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
else {
|
||||
} catch {}
|
||||
} else {
|
||||
do {
|
||||
try deleteData(forKey: key)
|
||||
}
|
||||
catch{}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public enum CloudKitZoneError: LocalizedError {
|
||||
}
|
||||
|
||||
public protocol CloudKitZoneDelegate: AnyObject {
|
||||
func cloudKitDidModify(changed: [CKRecord], deleted: [CloudKitRecordKey], completion: @escaping (Result<Void, Error>) -> Void);
|
||||
func cloudKitDidModify(changed: [CKRecord], deleted: [CloudKitRecordKey], completion: @escaping (Result<Void, Error>) -> Void)
|
||||
}
|
||||
|
||||
public typealias CloudKitRecordKey = (recordType: CKRecord.RecordType, recordID: CKRecord.ID)
|
||||
@ -111,7 +111,7 @@ public extension CloudKitZone {
|
||||
return CKRecord.ID(recordName: UUID().uuidString, zoneID: zoneID)
|
||||
}
|
||||
|
||||
func retryIfPossible(after: Double, block: @escaping () -> ()) {
|
||||
func retryIfPossible(after: Double, block: @escaping () -> Void) {
|
||||
let delayTime = DispatchTime.now() + after
|
||||
DispatchQueue.main.asyncAfter(deadline: delayTime, execute: {
|
||||
block()
|
||||
@ -125,7 +125,7 @@ public extension CloudKitZone {
|
||||
return
|
||||
}
|
||||
|
||||
fetchChangesInZone() { result in
|
||||
fetchChangesInZone { result in
|
||||
if case .failure(let error) = result {
|
||||
os_log(.error, log: self.log, "%@ zone remote notification fetch error: %@", self.zoneID.zoneName, error.localizedDescription)
|
||||
}
|
||||
@ -140,7 +140,7 @@ public extension CloudKitZone {
|
||||
return
|
||||
}
|
||||
|
||||
database.save(CKRecordZone(zoneID: zoneID)) { (recordZone, error) in
|
||||
database.save(CKRecordZone(zoneID: zoneID)) { (_, error) in
|
||||
if let error = error {
|
||||
DispatchQueue.main.async {
|
||||
completion(.failure(CloudKitError(error)))
|
||||
@ -211,7 +211,7 @@ public extension CloudKitZone {
|
||||
switch CloudKitZoneResult.resolve(error) {
|
||||
|
||||
case .zoneNotFound:
|
||||
self.createZoneRecord() { result in
|
||||
self.createZoneRecord { result in
|
||||
switch result {
|
||||
case .success:
|
||||
self.query(ckQuery, desiredKeys: desiredKeys, completion: completion)
|
||||
@ -285,7 +285,7 @@ public extension CloudKitZone {
|
||||
switch CloudKitZoneResult.resolve(error) {
|
||||
|
||||
case .zoneNotFound:
|
||||
self.createZoneRecord() { result in
|
||||
self.createZoneRecord { result in
|
||||
switch result {
|
||||
case .success:
|
||||
self.query(cursor: cursor, desiredKeys: desiredKeys, carriedRecords: records, completion: completion)
|
||||
@ -315,7 +315,6 @@ public extension CloudKitZone {
|
||||
database?.add(op)
|
||||
}
|
||||
|
||||
|
||||
/// Fetch a CKRecord by using its externalID
|
||||
func fetch(externalID: String?, completion: @escaping (Result<CKRecord, Error>) -> Void) {
|
||||
guard let externalID = externalID else {
|
||||
@ -341,7 +340,7 @@ public extension CloudKitZone {
|
||||
}
|
||||
}
|
||||
case .zoneNotFound:
|
||||
self.createZoneRecord() { result in
|
||||
self.createZoneRecord { result in
|
||||
switch result {
|
||||
case .success:
|
||||
self.fetch(externalID: externalID, completion: completion)
|
||||
@ -405,7 +404,7 @@ public extension CloudKitZone {
|
||||
}
|
||||
|
||||
case .zoneNotFound:
|
||||
self.createZoneRecord() { result in
|
||||
self.createZoneRecord { result in
|
||||
switch result {
|
||||
case .success:
|
||||
self.saveIfNew(records, completion: completion)
|
||||
@ -473,7 +472,7 @@ public extension CloudKitZone {
|
||||
completion(.success((savedSubscription!)))
|
||||
}
|
||||
case .zoneNotFound:
|
||||
self.createZoneRecord() { result in
|
||||
self.createZoneRecord { result in
|
||||
switch result {
|
||||
case .success:
|
||||
self.save(subscription, completion: completion)
|
||||
@ -666,7 +665,7 @@ public extension CloudKitZone {
|
||||
switch CloudKitZoneResult.resolve(error) {
|
||||
|
||||
case .zoneNotFound:
|
||||
self.createZoneRecord() { result in
|
||||
self.createZoneRecord { result in
|
||||
switch result {
|
||||
case .success:
|
||||
self.modify(recordsToSave: recordsToSave, recordIDsToDelete: recordIDsToDelete, completion: completion)
|
||||
@ -727,7 +726,7 @@ public extension CloudKitZone {
|
||||
}
|
||||
}
|
||||
|
||||
saveChunks() { result in
|
||||
saveChunks { result in
|
||||
switch result {
|
||||
case .success:
|
||||
deleteChunks()
|
||||
@ -763,11 +762,11 @@ public extension CloudKitZone {
|
||||
op.fetchAllChanges = true
|
||||
op.qualityOfService = Self.qualityOfService
|
||||
|
||||
op.recordZoneChangeTokensUpdatedBlock = { zoneID, token, _ in
|
||||
op.recordZoneChangeTokensUpdatedBlock = { _, token, _ in
|
||||
savedChangeToken = token
|
||||
}
|
||||
|
||||
op.recordWasChangedBlock = { recordID, result in
|
||||
op.recordWasChangedBlock = { _, result in
|
||||
if let record = try? result.get() {
|
||||
changedRecords.append(record)
|
||||
}
|
||||
@ -778,7 +777,7 @@ public extension CloudKitZone {
|
||||
deletedRecordKeys.append(recordKey)
|
||||
}
|
||||
|
||||
op.recordZoneFetchResultBlock = { recordZoneID, result in
|
||||
op.recordZoneFetchResultBlock = { _, result in
|
||||
if let (token, _, _) = try? result.get() {
|
||||
savedChangeToken = token
|
||||
}
|
||||
@ -809,7 +808,7 @@ public extension CloudKitZone {
|
||||
switch CloudKitZoneResult.resolve(error) {
|
||||
|
||||
case .zoneNotFound:
|
||||
self.createZoneRecord() { result in
|
||||
self.createZoneRecord { result in
|
||||
switch result {
|
||||
case .success:
|
||||
self.fetchChangesInZone(completion: completion)
|
||||
|
@ -21,7 +21,7 @@ struct QueueCall: Equatable {
|
||||
|
||||
func perform() {
|
||||
|
||||
let _ = target?.perform(selector)
|
||||
_ = target?.perform(selector)
|
||||
}
|
||||
|
||||
static func ==(lhs: QueueCall, rhs: QueueCall) -> Bool {
|
||||
@ -38,7 +38,7 @@ struct QueueCall: Equatable {
|
||||
private let interval: TimeInterval
|
||||
private let maxInterval: TimeInterval
|
||||
private var lastCallTime = Date.distantFuture
|
||||
private var timer: Timer? = nil
|
||||
private var timer: Timer?
|
||||
private var calls = [QueueCall]()
|
||||
|
||||
public init(name: String, interval: TimeInterval = 0.05, maxInterval: TimeInterval = 2.0) {
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
|
||||
public extension FileManager {
|
||||
|
||||
|
||||
/// Returns whether a path refers to a folder.
|
||||
///
|
||||
/// - Parameter path: The file path to check.
|
||||
@ -101,7 +100,7 @@ private extension FileManager {
|
||||
assert(fileExists(atPath: source))
|
||||
|
||||
if fileExists(atPath: destination) {
|
||||
if (overwriting) {
|
||||
if overwriting {
|
||||
try removeItem(atPath: destination)
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ public extension CGRect {
|
||||
/// - Returns: A new rectangle, cenetered vertically in `containerRect`,
|
||||
/// with the same size as the source rectangle.
|
||||
func centeredVertically(in containerRect: CGRect) -> CGRect {
|
||||
var r = self;
|
||||
r.origin.y = containerRect.midY - (r.height / 2.0);
|
||||
r = r.integral;
|
||||
r.size = self.size;
|
||||
return r;
|
||||
var r = self
|
||||
r.origin.y = containerRect.midY - (r.height / 2.0)
|
||||
r = r.integral
|
||||
r.size = self.size
|
||||
return r
|
||||
}
|
||||
|
||||
/// Centers a rectangle horizontally in another rectangle.
|
||||
@ -29,11 +29,11 @@ public extension CGRect {
|
||||
/// - Returns: A new rectangle, cenetered horizontally in `containerRect`,
|
||||
/// with the same size as the source rectangle.
|
||||
func centeredHorizontally(in containerRect: CGRect) -> CGRect {
|
||||
var r = self;
|
||||
r.origin.x = containerRect.midX - (r.width / 2.0);
|
||||
r = r.integral;
|
||||
r.size = self.size;
|
||||
return r;
|
||||
var r = self
|
||||
r.origin.x = containerRect.midX - (r.width / 2.0)
|
||||
r = r.integral
|
||||
r.size = self.size
|
||||
return r
|
||||
}
|
||||
|
||||
/// Centers a rectangle in another rectangle.
|
||||
|
@ -89,8 +89,7 @@ public extension MainThreadOperation {
|
||||
}
|
||||
if Thread.isMainThread {
|
||||
operationDelegate?.operationDidComplete(self)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.informOperationDelegateOfCompletion()
|
||||
}
|
||||
|
@ -182,8 +182,7 @@ private extension MainThreadOperationQueue {
|
||||
|
||||
if operation.isCanceled {
|
||||
dependencies.operationIDWasCanceled(operationID)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dependencies.operationIDDidComplete(operationID)
|
||||
}
|
||||
|
||||
|
@ -69,14 +69,14 @@ public final class ManagedResourceFile: NSObject, NSFilePresenter {
|
||||
|
||||
public func relinquishPresentedItem(toReader reader: @escaping ((() -> Void)?) -> Void) {
|
||||
saveQueue.isPaused = true
|
||||
reader() {
|
||||
reader {
|
||||
self.saveQueue.isPaused = false
|
||||
}
|
||||
}
|
||||
|
||||
public func relinquishPresentedItem(toWriter writer: @escaping ((() -> Void)?) -> Void) {
|
||||
saveQueue.isPaused = true
|
||||
writer() {
|
||||
writer {
|
||||
self.saveQueue.isPaused = false
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,7 @@ public func data(withPropertyList plist: Any) -> Data? {
|
||||
|
||||
do {
|
||||
return try PropertyListSerialization.data(fromPropertyList: plist, format: .binary, options: 0)
|
||||
}
|
||||
catch {
|
||||
} catch {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,6 @@ public extension RSImage {
|
||||
return CGImageSourceCreateImageAtIndex(imageSource, i, nil)
|
||||
}
|
||||
|
||||
|
||||
// If the image data contains a smaller image than the max size, just return it.
|
||||
for i in 0..<numberOfImages {
|
||||
|
||||
|
@ -20,4 +20,3 @@ public protocol Renamable {
|
||||
func rename(to: String, completion: @escaping (_ result: Result<Void, Error>) -> Void)
|
||||
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,6 @@ public struct SendToBlogEditorApp {
|
||||
self.sourceFeedURL = sourceFeedURL
|
||||
}
|
||||
|
||||
|
||||
/// Sends the receiver's data to the blog editor application described by `targetDescriptor`.
|
||||
public func send() {
|
||||
|
||||
@ -57,7 +56,7 @@ public struct SendToBlogEditorApp {
|
||||
|
||||
appleEvent.setParam(paramDescriptor, forKeyword: keyDirectObject)
|
||||
|
||||
let _ = try? appleEvent.sendEvent(options: [.noReply, .canSwitchLayer, .alwaysInteract], timeout: .AEDefaultTimeout)
|
||||
_ = try? appleEvent.sendEvent(options: [.noReply, .canSwitchLayer, .alwaysInteract], timeout: .AEDefaultTimeout)
|
||||
|
||||
}
|
||||
|
||||
|
@ -46,4 +46,3 @@ public protocol SendToCommand {
|
||||
/// - selectedText: The currently selected text.
|
||||
func sendObject(_ object: Any?, selectedText: String?)
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public extension String {
|
||||
|
||||
let s = self.trimmingWhitespace
|
||||
|
||||
if (s.isEmpty || (!s.contains(".") && !s.mayBeIPv6URL && !s.hostMayBeLocalhost)) {
|
||||
if s.isEmpty || (!s.contains(".") && !s.mayBeIPv6URL && !s.hostMayBeLocalhost) {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ public extension String {
|
||||
return self.replacingCharacters(in: range, with: "")
|
||||
}
|
||||
|
||||
return self;
|
||||
return self
|
||||
}
|
||||
|
||||
/// Removes an HTML tag and everything between its start and end tags.
|
||||
@ -264,7 +264,7 @@ public extension String {
|
||||
|
||||
if let maxCharacters = maxCharacters {
|
||||
charactersAdded += 1
|
||||
if (charactersAdded >= maxCharacters) {
|
||||
if charactersAdded >= maxCharacters {
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -309,7 +309,6 @@ public extension String {
|
||||
return s.replacingOccurrences(of: "\\n{3,}", with: "\n\n", options: .regularExpression)
|
||||
}
|
||||
|
||||
|
||||
/// Returns a Boolean value indicating whether the string contains another string, case-insensitively.
|
||||
///
|
||||
/// - Parameter string: The string to search for.
|
||||
|
@ -11,7 +11,7 @@ import UIKit
|
||||
|
||||
extension UIResponder {
|
||||
|
||||
private weak static var _currentFirstResponder: UIResponder? = nil
|
||||
private weak static var _currentFirstResponder: UIResponder?
|
||||
|
||||
public static var isFirstResponderTextField: Bool {
|
||||
var isTextField = false
|
||||
|
@ -23,7 +23,7 @@ extension UndoableCommand {
|
||||
public func registerUndo() {
|
||||
|
||||
undoManager.setActionName(undoActionName)
|
||||
undoManager.registerUndo(withTarget: self) { (target) in
|
||||
undoManager.registerUndo(withTarget: self) { (_) in
|
||||
self.undo()
|
||||
}
|
||||
}
|
||||
@ -31,7 +31,7 @@ extension UndoableCommand {
|
||||
public func registerRedo() {
|
||||
|
||||
undoManager.setActionName(redoActionName)
|
||||
undoManager.registerUndo(withTarget: self) { (target) in
|
||||
undoManager.registerUndo(withTarget: self) { (_) in
|
||||
self.perform()
|
||||
}
|
||||
}
|
||||
|
@ -67,5 +67,3 @@ private final class IndeterminateProgressWindowController: NSWindowController {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ public final class WebViewWindowController: NSWindowController {
|
||||
|
||||
// We assume there might be images, style sheets, etc. contained by the folder that the file appears in, so we get read access to the parent folder.
|
||||
|
||||
let _ = self.window
|
||||
_ = self.window
|
||||
|
||||
let fileURL = URL(fileURLWithPath: path)
|
||||
let folderURL = fileURL.deletingLastPathComponent()
|
||||
|
@ -44,7 +44,7 @@ class MacroProcessorTests: XCTestCase {
|
||||
func testEmptyDelimiters() {
|
||||
do {
|
||||
let template = "foo bar"
|
||||
let _ = try MacroProcessor.renderedText(withTemplate: template, substitutions: substitutions, macroStart: "")
|
||||
_ = try MacroProcessor.renderedText(withTemplate: template, substitutions: substitutions, macroStart: "")
|
||||
XCTFail("Error should be thrown")
|
||||
} catch {
|
||||
// Success
|
||||
@ -52,7 +52,7 @@ class MacroProcessorTests: XCTestCase {
|
||||
|
||||
do {
|
||||
let template = "foo bar"
|
||||
let _ = try MacroProcessor.renderedText(withTemplate: template, substitutions: substitutions, macroEnd: "")
|
||||
_ = try MacroProcessor.renderedText(withTemplate: template, substitutions: substitutions, macroEnd: "")
|
||||
XCTFail("Error should be thrown")
|
||||
} catch {
|
||||
// Success
|
||||
|
@ -232,7 +232,7 @@ class MainThreadOperationTests: XCTestCase {
|
||||
var name: String?
|
||||
var completionBlock: MainThreadOperation.MainThreadOperationCompletionBlock?
|
||||
|
||||
var didStartRunBlock: (() -> ())?
|
||||
var didStartRunBlock: (() -> Void)?
|
||||
|
||||
init(didCancelExpectation: XCTestExpectation) {
|
||||
self.didCancelExpectation = didCancelExpectation
|
||||
|
@ -10,6 +10,6 @@ final class RSCoreTests: XCTestCase {
|
||||
}
|
||||
|
||||
static var allTests = [
|
||||
("testExample", testExample),
|
||||
("testExample", testExample)
|
||||
]
|
||||
}
|
||||
|
@ -168,16 +168,16 @@ class String_RSCore: XCTestCase {
|
||||
|
||||
self.measure {
|
||||
for _ in 0..<1000 {
|
||||
let _ = s1.md5String
|
||||
let _ = s2.md5String
|
||||
let _ = s3.md5String
|
||||
let _ = s4.md5String
|
||||
let _ = s5.md5String
|
||||
let _ = s6.md5String
|
||||
let _ = s7.md5String
|
||||
let _ = s8.md5String
|
||||
let _ = s9.md5String
|
||||
let _ = s10.md5String
|
||||
_ = s1.md5String
|
||||
_ = s2.md5String
|
||||
_ = s3.md5String
|
||||
_ = s4.md5String
|
||||
_ = s5.md5String
|
||||
_ = s6.md5String
|
||||
_ = s7.md5String
|
||||
_ = s8.md5String
|
||||
_ = s9.md5String
|
||||
_ = s10.md5String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import XCTest
|
||||
#if !canImport(ObjectiveC)
|
||||
public func allTests() -> [XCTestCaseEntry] {
|
||||
return [
|
||||
testCase(RSCoreTests.allTests),
|
||||
testCase(RSCoreTests.allTests)
|
||||
]
|
||||
}
|
||||
#endif
|
||||
|
@ -9,7 +9,7 @@ let package = Package(
|
||||
.library(
|
||||
name: "RSTree",
|
||||
type: .dynamic,
|
||||
targets: ["RSTree"]),
|
||||
targets: ["RSTree"])
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
|
@ -36,8 +36,7 @@ public extension NSOutlineView {
|
||||
selectRowIndexes(NSIndexSet(index: oneRow) as IndexSet, byExtendingSelection: false)
|
||||
scrollRowToVisible(oneRow)
|
||||
return true
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
expandItem(oneNode)
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,6 @@ public final class Node: Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public extension Array where Element == Node {
|
||||
|
||||
func representedObjects() -> [AnyObject] {
|
||||
|
@ -21,8 +21,7 @@ public struct NodePath {
|
||||
if let parent = nomad.parent {
|
||||
tempArray.append(parent)
|
||||
nomad = parent
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -34,8 +33,7 @@ public struct NodePath {
|
||||
|
||||
if let node = treeController.nodeInTreeRepresentingObject(representedObject) {
|
||||
self.init(node: node)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ private extension TreeController {
|
||||
let childNodes = delegate?.treeController(treeController: self, childNodesFor: node) ?? [Node]()
|
||||
|
||||
childNodesDidChange = !nodeArraysAreEqual(childNodes, node.childNodes)
|
||||
if (childNodesDidChange) {
|
||||
if childNodesDidChange {
|
||||
node.childNodes = childNodes
|
||||
}
|
||||
|
||||
|
@ -9,11 +9,11 @@ let package = Package(
|
||||
.library(
|
||||
name: "RSWeb",
|
||||
type: .dynamic,
|
||||
targets: ["RSWeb"]),
|
||||
targets: ["RSWeb"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(path: "../Parser"),
|
||||
.package(path: "../RSCore"),
|
||||
.package(path: "../RSCore")
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
@ -26,6 +26,6 @@ let package = Package(
|
||||
),
|
||||
.testTarget(
|
||||
name: "RSWebTests",
|
||||
dependencies: ["RSWeb"]),
|
||||
dependencies: ["RSWeb"])
|
||||
]
|
||||
)
|
||||
|
@ -40,7 +40,6 @@ public protocol DownloadSessionDelegate {
|
||||
/// These URLs are skipped for the rest of the session.
|
||||
private var urlsWith400s = Set<URL>()
|
||||
|
||||
|
||||
public init(delegate: DownloadSessionDelegate) {
|
||||
|
||||
self.delegate = delegate
|
||||
@ -279,7 +278,7 @@ private extension DownloadSession {
|
||||
|
||||
var currentURL = url
|
||||
|
||||
while(true) {
|
||||
while true {
|
||||
|
||||
if let oneRedirectURL = redirectCache[currentURL] {
|
||||
|
||||
@ -289,9 +288,7 @@ private extension DownloadSession {
|
||||
}
|
||||
urls.insert(oneRedirectURL)
|
||||
currentURL = oneRedirectURL
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public final class Downloader {
|
||||
urlRequestToUse.addSpecialCaseUserAgentIfNeeded()
|
||||
|
||||
let task = urlSession.dataTask(with: urlRequestToUse) { (data, response, error) in
|
||||
DispatchQueue.main.async() {
|
||||
DispatchQueue.main.async {
|
||||
completion?(data, response, error)
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ private extension HTMLMetadataDownloader {
|
||||
Self.logger.debug("HTMLMetadataDownloader downloading for \(url)")
|
||||
}
|
||||
|
||||
Downloader.shared.download(actualURL) { data, response, error in
|
||||
Downloader.shared.download(actualURL) { data, response, _ in
|
||||
if let data, !data.isEmpty, let response, response.statusIsOK {
|
||||
let urlToUse = response.url ?? actualURL
|
||||
let parserData = ParserData(url: urlToUse.absoluteString, data: data)
|
||||
|
@ -21,7 +21,7 @@ public class MacWebBrowser {
|
||||
return false
|
||||
}
|
||||
|
||||
if (inBackground) {
|
||||
if inBackground {
|
||||
|
||||
let configuration = NSWorkspace.OpenConfiguration()
|
||||
configuration.activates = false
|
||||
|
@ -48,8 +48,8 @@ public class Reachability {
|
||||
return reachability.connection != .unavailable
|
||||
}
|
||||
|
||||
public typealias NetworkReachable = (Reachability) -> ()
|
||||
public typealias NetworkUnreachable = (Reachability) -> ()
|
||||
public typealias NetworkReachable = (Reachability) -> Void
|
||||
public typealias NetworkUnreachable = (Reachability) -> Void
|
||||
|
||||
public enum Connection: CustomStringConvertible {
|
||||
@available(*, deprecated, renamed: "unavailable")
|
||||
|
@ -22,8 +22,7 @@ extension URL {
|
||||
let result: Bool
|
||||
if let host = host(), host.contains("openrss.org") {
|
||||
result = true
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
result = false
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,7 @@ public extension URL {
|
||||
|
||||
if isHTTPSURL() {
|
||||
return absoluteString.stringByRemovingCaseInsensitivePrefix(URLConstants.prefixHTTPS)
|
||||
}
|
||||
else if isHTTPURL() {
|
||||
} else if isHTTPURL() {
|
||||
return absoluteString.stringByRemovingCaseInsensitivePrefix(URLConstants.prefixHTTP)
|
||||
}
|
||||
|
||||
@ -76,7 +75,7 @@ private extension String {
|
||||
let lowerPrefix = prefix.lowercased()
|
||||
let lowerSelf = self.lowercased()
|
||||
|
||||
if (lowerSelf == lowerPrefix) {
|
||||
if lowerSelf == lowerPrefix {
|
||||
return ""
|
||||
}
|
||||
if !lowerSelf.hasPrefix(lowerPrefix) {
|
||||
|
@ -173,7 +173,7 @@ extension URLSession: Transport {
|
||||
var sendRequest = request
|
||||
sendRequest.httpMethod = method
|
||||
|
||||
let task = self.dataTask(with: sendRequest) { (data, response, error) in
|
||||
let task = self.dataTask(with: sendRequest) { (_, response, error) in
|
||||
DispatchQueue.main.async {
|
||||
if let error = error {
|
||||
return completion(.failure(error))
|
||||
|
@ -33,15 +33,13 @@ extension Transport {
|
||||
DispatchQueue.main.async {
|
||||
completion(.success((response, decoded)))
|
||||
}
|
||||
}
|
||||
catch {
|
||||
} catch {
|
||||
DispatchQueue.main.async {
|
||||
completion(.failure(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
completion(.success((response, nil)))
|
||||
}
|
||||
|
||||
|
@ -11,16 +11,6 @@ import XCTest
|
||||
|
||||
class RSWebTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
@ -36,7 +26,7 @@ class RSWebTests: XCTestCase {
|
||||
func testAllBrowsers() {
|
||||
let browsers = MacWebBrowser.sortedBrowsers()
|
||||
|
||||
XCTAssertNotNil(browsers);
|
||||
XCTAssertNotNil(browsers)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,8 +49,7 @@ struct SyncStatusTable: DatabaseTable {
|
||||
DispatchQueue.main.async {
|
||||
if let error = error {
|
||||
completion(.failure(error))
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
completion(.success(Array(statuses)))
|
||||
}
|
||||
}
|
||||
@ -79,8 +78,7 @@ struct SyncStatusTable: DatabaseTable {
|
||||
DispatchQueue.main.async {
|
||||
if let error = error {
|
||||
completion(.failure(error))
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
completion(.success(count))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user