mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix lint issues.
This commit is contained in:
@@ -59,26 +59,26 @@ public final class DownloadProgress {
|
||||
|
||||
public func addToNumberOfTasks(_ n: Int) {
|
||||
assert(Thread.isMainThread)
|
||||
numberOfTasks = numberOfTasks + n
|
||||
numberOfTasks += n
|
||||
}
|
||||
|
||||
public func addToNumberOfTasksAndRemaining(_ n: Int) {
|
||||
assert(Thread.isMainThread)
|
||||
numberOfTasks = numberOfTasks + n
|
||||
numberRemaining = numberRemaining + n
|
||||
numberOfTasks += n
|
||||
numberRemaining += n
|
||||
}
|
||||
|
||||
public func completeTask() {
|
||||
assert(Thread.isMainThread)
|
||||
if numberRemaining > 0 {
|
||||
numberRemaining = numberRemaining - 1
|
||||
numberRemaining -= 1
|
||||
}
|
||||
}
|
||||
|
||||
public func completeTasks(_ tasks: Int) {
|
||||
assert(Thread.isMainThread)
|
||||
if numberRemaining >= tasks {
|
||||
numberRemaining = numberRemaining - tasks
|
||||
numberRemaining -= tasks
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import os
|
||||
// Create a DownloadSessionDelegate, then create a DownloadSession.
|
||||
// To download things: call download with a set of URLs. DownloadSession will call the various delegate methods.
|
||||
|
||||
public protocol DownloadSessionDelegate {
|
||||
public protocol DownloadSessionDelegate: AnyObject {
|
||||
|
||||
func downloadSession(_ downloadSession: DownloadSession, conditionalGetInfoFor: URL) -> HTTPConditionalGetInfo?
|
||||
func downloadSession(_ downloadSession: DownloadSession, downloadDidComplete: URL, response: URLResponse?, data: Data, error: NSError?)
|
||||
@@ -246,7 +246,7 @@ private extension DownloadSession {
|
||||
updateDownloadProgress()
|
||||
}
|
||||
|
||||
func urlStringIsBlackListedRedirect(_ urlString: String) -> Bool {
|
||||
func urlStringIsDisallowedRedirect(_ urlString: String) -> Bool {
|
||||
|
||||
// Hotels and similar often do permanent redirects. We can catch some of those.
|
||||
|
||||
@@ -263,7 +263,7 @@ private extension DownloadSession {
|
||||
}
|
||||
|
||||
func cacheRedirect(_ oldURL: URL, _ newURL: URL) {
|
||||
if urlStringIsBlackListedRedirect(newURL.absoluteString) {
|
||||
if urlStringIsDisallowedRedirect(newURL.absoluteString) {
|
||||
return
|
||||
}
|
||||
redirectCache[oldURL] = newURL
|
||||
|
||||
@@ -86,17 +86,13 @@ public class Reachability {
|
||||
fileprivate let reachabilitySerialQueue: DispatchQueue
|
||||
fileprivate(set) var flags: SCNetworkReachabilityFlags?
|
||||
|
||||
required public init(reachabilityRef: SCNetworkReachability,
|
||||
queueQoS: DispatchQoS = .default,
|
||||
targetQueue: DispatchQueue? = nil) {
|
||||
required public init(reachabilityRef: SCNetworkReachability, queueQoS: DispatchQoS = .default, targetQueue: DispatchQueue? = nil) {
|
||||
self.allowsCellularConnection = true
|
||||
self.reachabilityRef = reachabilityRef
|
||||
self.reachabilitySerialQueue = DispatchQueue(label: "uk.co.ashleymills.reachability", qos: queueQoS, target: targetQueue)
|
||||
}
|
||||
|
||||
public convenience init(hostname: String,
|
||||
queueQoS: DispatchQoS = .default,
|
||||
targetQueue: DispatchQueue? = nil) throws {
|
||||
public convenience init(hostname: String, queueQoS: DispatchQoS = .default, targetQueue: DispatchQueue? = nil) throws {
|
||||
guard let ref = SCNetworkReachabilityCreateWithName(nil, hostname) else {
|
||||
throw ReachabilityError.failedToCreateWithHostname(hostname, SCError())
|
||||
}
|
||||
@@ -192,16 +188,16 @@ extension SCNetworkReachabilityFlags {
|
||||
}
|
||||
|
||||
var description: String {
|
||||
let W = isOnWWANFlagSet ? "W" : "-"
|
||||
let R = isReachableFlagSet ? "R" : "-"
|
||||
let c = isConnectionRequiredFlagSet ? "c" : "-"
|
||||
let t = isTransientConnectionFlagSet ? "t" : "-"
|
||||
let i = isInterventionRequiredFlagSet ? "i" : "-"
|
||||
let C = isConnectionOnTrafficFlagSet ? "C" : "-"
|
||||
let D = isConnectionOnDemandFlagSet ? "D" : "-"
|
||||
let l = isLocalAddressFlagSet ? "l" : "-"
|
||||
let d = isDirectFlagSet ? "d" : "-"
|
||||
let onWWANFlagSet = isOnWWANFlagSet ? "W" : "-"
|
||||
let reachableFlagSet = isReachableFlagSet ? "R" : "-"
|
||||
let connectionRequiredFlagSet = isConnectionRequiredFlagSet ? "c" : "-"
|
||||
let transientConnectionFlagSet = isTransientConnectionFlagSet ? "t" : "-"
|
||||
let interventionRequiredFlagSet = isInterventionRequiredFlagSet ? "i" : "-"
|
||||
let connectionOnTrafficFlagSet = isConnectionOnTrafficFlagSet ? "C" : "-"
|
||||
let connectionOnDemandFlagSet = isConnectionOnDemandFlagSet ? "D" : "-"
|
||||
let localAddressFlagSet = isLocalAddressFlagSet ? "l" : "-"
|
||||
let directFlagSet = isDirectFlagSet ? "d" : "-"
|
||||
|
||||
return "\(W)\(R) \(c)\(t)\(i)\(C)\(D)\(l)\(d)"
|
||||
return "\(onWWANFlagSet)\(reachableFlagSet) \(connectionRequiredFlagSet)\(transientConnectionFlagSet)\(interventionRequiredFlagSet)\(connectionOnTrafficFlagSet)\(connectionOnDemandFlagSet)\(localAddressFlagSet)\(directFlagSet)"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user