Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Xcode 11.4.1 support #2828
Xcode 11.4.1 support #2828
Conversation
| @@ -158,7 +158,7 @@ extension ThreadsViewController { | |||
| return .zero | |||
| } | |||
|
|
|||
| override func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | |||
| func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | |||
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 160 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 160 characters (line_length)
| @@ -633,7 +633,7 @@ extension MessagesViewController { | |||
| return .zero | |||
| } | |||
|
|
|||
| override func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | |||
| func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | |||
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 160 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 160 characters (line_length)
| } else if let encodedString_ = self.rawString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) { | ||
| if rawString.range(of: "%[0-9A-Fa-f]{2}", options: .regularExpression, range: nil, locale: nil) != nil { | ||
| return Foundation.URL(string: rawString) | ||
| } else if let encodedString_ = rawString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) { |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should only contain alphanumeric characters: 'encodedString_' (identifier_name)
Identifier Name Violation: Variable name should only contain alphanumeric characters: 'encodedString_' (identifier_name)
| @@ -923,17 +842,15 @@ extension JSON { | |||
| extension JSON { | |||
|
|
|||
| public var null: NSNull? { | |||
| set { | |||
houndci-bot
Apr 17, 2020
Unused Setter Value Violation: Setter value is not used. (unused_setter_value)
Unused Setter Value Violation: Setter value is not used. (unused_setter_value)
| if self.type == .dictionary { | ||
| if let o = self.rawDictionary[key] { | ||
| if type == .dictionary { | ||
| if let o = rawDictionary[key] { |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'o' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'o' (identifier_name)
| @@ -284,7 +284,7 @@ public class AudioView: UIView { | |||
| layer.cornerRadius = Consts.layerCornerRadius | |||
| clipsToBounds = true | |||
|
|
|||
| NotificationCenter.default.addObserver(forName: .UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in | |||
| NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in | |||
houndci-bot
Apr 17, 2020
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
| @@ -108,7 +108,7 @@ public class PreviewAudioView: UIView, ComposerLocalizable { | |||
| backgroundColor = .white | |||
| clipsToBounds = true | |||
|
|
|||
| NotificationCenter.default.addObserver(forName: .UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in | |||
| NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in | |||
houndci-bot
Apr 17, 2020
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
| @@ -317,7 +317,7 @@ public class SwipeIndicatorView: UIView, ComposerLocalizable { | |||
| private func commonInit() { | |||
| clipsToBounds = true | |||
|
|
|||
| NotificationCenter.default.addObserver(forName: .UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in | |||
| NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in | |||
houndci-bot
Apr 17, 2020
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
| @@ -121,7 +121,7 @@ public class RecordAudioView: UIView { | |||
| repeats: true | |||
| ) | |||
|
|
|||
| NotificationCenter.default.addObserver(forName: .UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in | |||
| NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in | |||
houndci-bot
Apr 17, 2020
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
| actionsContainerView.center = CGPoint(x: targetCenter, y: actionsContainerView.center.y) | ||
| swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX) | ||
| } | ||
|
|
houndci-bot
Apr 17, 2020
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
| guard let swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return } | ||
|
|
||
| let targetCenter = self.targetCenter(active: false) | ||
|
|
houndci-bot
Apr 17, 2020
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
| @@ -481,6 +482,15 @@ extension SwipeController: SwipeActionsViewDelegate { | |||
| delegate?.swipeController(self, didEndEditingSwipeableFor: actionView.orientation) | |||
| } | |||
|
|
|||
| func resetSwipe() { | |||
| guard let swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return } | |||
|
|
|||
houndci-bot
Apr 17, 2020
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
| contentView.bottomAnchor.constraint(equalTo: self.bottomAnchor), | ||
| ]) | ||
| } | ||
|
|
houndci-bot
Apr 17, 2020
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
| contentView.leadingAnchor.constraint(equalTo: self.leadingAnchor), | ||
| contentView.topAnchor.constraint(equalTo: self.topAnchor), | ||
| contentView.trailingAnchor.constraint(equalTo: self.trailingAnchor), | ||
| contentView.bottomAnchor.constraint(equalTo: self.bottomAnchor), |
houndci-bot
Apr 17, 2020
Trailing Comma Violation: Collection literals should not have trailing commas. (trailing_comma)
Trailing Comma Violation: Collection literals should not have trailing commas. (trailing_comma)
| @@ -82,6 +82,17 @@ open class SwipeCollectionViewCell: UICollectionViewCell { | |||
| func configure() { | |||
| contentView.clipsToBounds = false | |||
|
|
|||
| if contentView.translatesAutoresizingMaskIntoConstraints == true { | |||
| contentView.translatesAutoresizingMaskIntoConstraints = false | |||
|
|
|||
houndci-bot
Apr 17, 2020
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
| @@ -83,7 +83,7 @@ public class EditingView: UIView, ComposerLocalizable { | |||
| clipsToBounds = true | |||
| isHidden = true | |||
|
|
|||
| NotificationCenter.default.addObserver(forName: .UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in | |||
| NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in | |||
houndci-bot
Apr 17, 2020
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
| @@ -89,6 +90,8 @@ public func dynamicBridgeCast<T>(fromObjectiveC x: Any) -> T { | |||
| return unsafeBitCast(x as AnyObject, to: T.self) | |||
| } else if let bridgeableType = T.self as? CustomObjectiveCBridgeable.Type { | |||
| return bridgeableType.bridging(objCValue: x) as! T | |||
| } else if let bridgeableType = T.self as? RealmEnum.Type { | |||
| return bridgeableType._rlmFromRawValue(x) as! T | |||
houndci-bot
Apr 17, 2020
Force Cast Violation: Force casts should be avoided. (force_cast)
Force Cast Violation: Force casts should be avoided. (force_cast)
| stopPolicy: stopPolicy, | ||
| enableSSLValidation: validateSSL, | ||
| certificatePath: certificate) | ||
| let c = RLMSyncConfiguration(user: user, realmURL: realmURL, |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'c' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'c' (identifier_name)
| @discardableResult | ||
| @available(*, deprecated, message: "Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.") | ||
| @available(*, unavailable, message: "Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 158 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 158 characters (line_length)
| @discardableResult | ||
| @available(*, deprecated, message: "Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.") | ||
| @available(*, unavailable, message: "Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 158 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 158 characters (line_length)
| */ | ||
| @available(*, deprecated, message: "Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.") | ||
| /// :nodoc: | ||
| @available(*, unavailable, message: "Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 158 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 158 characters (line_length)
| */ | ||
| @available(*, deprecated, message: "Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.") | ||
| /// :nodoc: | ||
| @available(*, unavailable, message: "Pass .error, .modified or .all rather than a boolean. .error is equivalent to false and .all is equivalent to true.") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 158 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 158 characters (line_length)
|
|
||
| - throws: An `NSError` if the transaction could not be completed successfully. | ||
| If `block` throws, the function throws the propagated `ErrorType` instead. | ||
| */ | ||
| public func write(withoutNotifying tokens: [NotificationToken] = [], _ block: (() throws -> Void)) throws { | ||
| @discardableResult | ||
| public func write<Result>(withoutNotifying tokens: [NotificationToken] = [], _ block: (() throws -> Result)) throws -> Result { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 131 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 131 characters (line_length)
| free(attrs) | ||
| } | ||
| var computed = true | ||
| for i in 0..<Int(count) { |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'i' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'i' (identifier_name)
| throwRealmException("Property \(cls).\(label) is declared as \(type(of: prop.value)), which is not a supported managed Object property type. If it is not supposed to be a managed property, either add it to `ignoredProperties()` or do not declare it as `@objc dynamic`. See https://realm.io/docs/swift/latest/api/Classes/Object.html for more information.") | ||
| } | ||
| if prop.value as? RealmOptionalProtocol != nil { | ||
| throwRealmException("Property \(cls).\(label) has unsupported RealmOptional type \(type(of: prop.value)). Extending RealmOptionalType with custom types is not currently supported. ") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 202 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 202 characters (line_length)
| public override final class func objectUtilClass(_ isSwift: Bool) -> AnyClass { | ||
| return ObjectUtil.self | ||
| public override final class func _getProperties(withInstance instance: Any) -> [RLMProperty] { | ||
| return ObjectUtil.getSwiftProperties(instance as! RLMObjectBase) |
houndci-bot
Apr 17, 2020
Force Cast Violation: Force casts should be avoided. (force_cast)
Force Cast Violation: Force casts should be avoided. (force_cast)
| case .end: return .end | ||
| } | ||
| } | ||
| } |
houndci-bot
Apr 17, 2020
File Line Length Violation: File should contain 400 lines or less: currently contains 474 (file_length)
File Line Length Violation: File should contain 400 lines or less: currently contains 474 (file_length)
| case begin, event, end | ||
|
|
||
| @available(OSX 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) | ||
| var os: OSSignpostType { |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'os' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'os' (identifier_name)
| // arguments, because Swift implicitly wraps `arguments CVarArg...` from `log` | ||
| // into an array and passes the array to `os_signpost` which is not what | ||
| // we expect. So in this scenario we have to limit the number of arguments | ||
| // to one, there is no way to pass more. For more info see https://stackoverflow.com/questions/50937765/why-does-wrapping-os-log-cause-doubles-to-not-be-logged-correctly |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 173 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 173 characters (line_length)
| private let name: StaticString | ||
| private let signpostsEnabled: Bool | ||
|
|
||
| init(_ log: OSLog, _ name: StaticString, _ signpostsEnabled: Bool = ImagePipeline.Configuration.isSignpostLoggingEnabled) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
|
|
||
| #elseif os(watchOS) | ||
|
|
||
| private func handle(result: Result<ImageResponse, ImagePipeline.Error>, fromMemCache: Bool, options: ImageLoadingOptions) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
| } | ||
|
|
||
| private func _display(_ image: Image, _ transition: ImageLoadingOptions.Transition?, _ alwaysTransition: Bool, _ fromMemCache: Bool) { | ||
| guard let imageView = imageView else { return } | ||
| private func display(_ image: NSImage, _ transition: ImageLoadingOptions.Transition?, _ alwaysTransition: Bool, _ fromMemCache: Bool) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 139 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 139 characters (line_length)
|
|
||
| private func handle(response: ImageResponse?, error: Error?, fromMemCache: Bool, options: ImageLoadingOptions) { | ||
| private func handle(result: Result<ImageResponse, ImagePipeline.Error>, fromMemCache: Bool, options: ImageLoadingOptions) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
| completion: nil | ||
| ) | ||
| } | ||
|
|
||
| /// Performs cross-dissolve animation alonside transition to a new content | ||
| /// mode. This isn't natively supported feature and it requires a second | ||
| /// image view. There might be better ways to implement it. | ||
| private func _runCrossDissolveWithContentMode(imageView: UIImageView, image: Image, params: ImageLoadingOptions.Transition.Parameters) { | ||
| private func runCrossDissolveWithContentMode(imageView: UIImageView, image: UIImage, params: ImageLoadingOptions.Transition.Parameters) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 141 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 141 characters (line_length)
| @@ -386,36 +441,40 @@ private final class ImageViewController { | |||
| // content modes. | |||
| private lazy var transitionImageView = UIImageView() | |||
|
|
|||
| private func _runFadeInTransition(image: Image, params: ImageLoadingOptions.Transition.Parameters, contentMode: UIView.ContentMode?) { | |||
| guard let imageView = imageView else { return } | |||
| private func runFadeInTransition(image: UIImage, params: ImageLoadingOptions.Transition.Parameters, contentMode: UIView.ContentMode?) { | |||
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 139 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 139 characters (line_length)
| /// An animated image transition. | ||
| public struct Transition { | ||
| var style: Style | ||
|
|
||
| enum Style { // internal representation |
houndci-bot
Apr 17, 2020
Nesting Violation: Types should be nested at most 1 level deep (nesting)
Nesting Violation: Types should be nested at most 1 level deep (nesting)
|
|
||
| #elseif os(macOS) | ||
|
|
||
| public init(placeholder: NSImage? = nil, transition: Transition? = nil, failureImage: NSImage? = nil, failureImageTransition: Transition? = nil) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 150 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 150 characters (line_length)
| @@ -182,57 +206,88 @@ public struct ImageLoadingOptions { | |||
| /// performed when displaying a failure image. `.nil` by default. | |||
| /// - parameter contentModes: Content modes to be used for each image type | |||
| /// (placeholder, success, failure). `nil` by default (don't change content mode). | |||
| public init(placeholder: Image? = nil, transition: Transition? = nil, failureImage: Image? = nil, failureImageTransition: Transition? = nil, contentModes: ContentModes? = nil) { | |||
| public init(placeholder: UIImage? = nil, transition: Transition? = nil, failureImage: UIImage? = nil, failureImageTransition: Transition? = nil, contentModes: ContentModes? = nil) { | |||
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 185 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 185 characters (line_length)
| metadata: LinkingObjectsBridgingMetadata.uncached(property: property!)) | ||
| } | ||
| var ret = LinkingObjects(fromType: Element.self, property: propertyName) | ||
| ret.handle = RLMLinkingObjectsHandle(object: object, property: RLMObjectBaseObjectSchema(object)![propertyName]!) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 121 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 121 characters (line_length)
| let C = isConnectionOnTrafficFlagSet ? "C" : "-" | ||
| let D = isConnectionOnDemandFlagSet ? "D" : "-" | ||
| let l = isLocalAddressFlagSet ? "l" : "-" | ||
| let d = isDirectFlagSet ? "d" : "-" |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'd' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'd' (identifier_name)
| try data.write(to: url) | ||
| } catch let error as NSError { | ||
| guard error.code == CocoaError.fileNoSuchFile.rawValue && error.domain == CocoaError.errorDomain else { return } | ||
| try? FileManager.default.createDirectory(at: self.path, withIntermediateDirectories: true, attributes: nil) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 131 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 131 characters (line_length)
| do { | ||
| try data.write(to: url) | ||
| } catch let error as NSError { | ||
| guard error.code == CocoaError.fileNoSuchFile.rawValue && error.domain == CocoaError.errorDomain else { return } |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 136 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 136 characters (line_length)
|
|
||
| /* testable */ let _wqueue = DispatchQueue(label: "com.github.kean.Nuke.DataCache.WriteQueue") | ||
| /* testable */ let wqueue = DispatchQueue(label: "com.github.kean.Nuke.DataCache.WriteQueue", target: .global(qos: .utility)) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 129 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 129 characters (line_length)
| let i = isInterventionRequiredFlagSet ? "i" : "-" | ||
| let C = isConnectionOnTrafficFlagSet ? "C" : "-" | ||
| let D = isConnectionOnDemandFlagSet ? "D" : "-" | ||
| let l = isLocalAddressFlagSet ? "l" : "-" |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'l' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'l' (identifier_name)
| let t = isTransientConnectionFlagSet ? "t" : "-" | ||
| let i = isInterventionRequiredFlagSet ? "i" : "-" | ||
| let C = isConnectionOnTrafficFlagSet ? "C" : "-" | ||
| let D = isConnectionOnDemandFlagSet ? "D" : "-" |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'D' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'D' (identifier_name)
| let c = isConnectionRequiredFlagSet ? "c" : "-" | ||
| let t = isTransientConnectionFlagSet ? "t" : "-" | ||
| let i = isInterventionRequiredFlagSet ? "i" : "-" | ||
| let C = isConnectionOnTrafficFlagSet ? "C" : "-" |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'C' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'C' (identifier_name)
| let R = isReachableFlagSet ? "R" : "-" | ||
| let c = isConnectionRequiredFlagSet ? "c" : "-" | ||
| let t = isTransientConnectionFlagSet ? "t" : "-" | ||
| let i = isInterventionRequiredFlagSet ? "i" : "-" |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'i' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'i' (identifier_name)
| let W = isOnWWANFlagSet ? "W" : "-" | ||
| let R = isReachableFlagSet ? "R" : "-" | ||
| let c = isConnectionRequiredFlagSet ? "c" : "-" | ||
| let t = isTransientConnectionFlagSet ? "t" : "-" |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 't' (identifier_name)
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 't' (identifier_name)
| self.isDeduplicationEnabled = isDeduplicationEnabled | ||
| } | ||
|
|
||
| func publisher(withKey key: AnyHashable, starter: @escaping (Task<Value, Error>) -> Void) -> Task<Value, Error>.Publisher { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
| /// Attaches the subscriber to the task. Automatically forwards progress | ||
| /// andd error events to the given task. | ||
| /// - notes: Returns `nil` if the task is already disposed. | ||
| func subscribe<NewValue>(_ task: Task<NewValue, Error>, onValue: @escaping (Value, Bool, Task<NewValue, Error>) -> Void) -> TaskSubscription? { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 151 characters (line_length)
| // MARK: - Managing Observers | ||
|
|
||
| /// - notes: Returns `nil` if the task was disposed. | ||
| fileprivate func subscribe(priority: TaskPriority = .normal, _ observer: @escaping (Event) -> Void) -> TaskSubscription? { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 126 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 126 characters (line_length)
| // MARK: - CustomStringConvertible | ||
|
|
||
| public var description: String { | ||
| return "ImageTask(id: \(taskId), priority: \(priority), completedUnitCount: \(completedUnitCount), totalUnitCount: \(totalUnitCount), isCancelled: \(isCancelled))" |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 171 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 171 characters (line_length)
| /// A progress handler to be called periodically during the lifetime of a task. | ||
| public typealias ProgressHandler = (_ intermediateResponse: ImageResponse?, _ completedUnitCount: Int64, _ totalUnitCount: Int64) -> Void | ||
|
|
||
| init(taskId: Int, request: ImageRequest, isMainThreadConfined: Bool = false, isDataTask: Bool, queue: DispatchQueue?) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 123 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 123 characters (line_length)
| public typealias Completion = (_ result: Result<ImageResponse, ImagePipeline.Error>) -> Void | ||
|
|
||
| /// A progress handler to be called periodically during the lifetime of a task. | ||
| public typealias ProgressHandler = (_ intermediateResponse: ImageResponse?, _ completedUnitCount: Int64, _ totalUnitCount: Int64) -> Void |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 141 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 141 characters (line_length)
| defer { lock?.unlock() } | ||
| return _isCancelled | ||
| } | ||
| private(set) var _isCancelled = false |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should only contain alphanumeric characters: '_isCancelled' (identifier_name)
Identifier Name Violation: Variable name should only contain alphanumeric characters: '_isCancelled' (identifier_name)
| if _progress == nil { _progress = Progress() } | ||
| return _progress! | ||
| } | ||
| private(set) var _progress: Progress? |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should only contain alphanumeric characters: '_progress' (identifier_name)
Identifier Name Violation: Variable name should only contain alphanumeric characters: '_progress' (identifier_name)
| pipeline?.imageTaskUpdatePriorityCalled(self, priority: priority) | ||
| } | ||
| } | ||
| var _priority: ImageRequest.Priority // Backing store for access from pipeline |
houndci-bot
Apr 17, 2020
Identifier Name Violation: Variable name should only contain alphanumeric characters: '_priority' (identifier_name)
Identifier Name Violation: Variable name should only contain alphanumeric characters: '_priority' (identifier_name)
| processors: [ImageProcessing] = [], | ||
| priority: ImageRequest.Priority = .normal, | ||
| options: ImageRequestOptions = .init()) { | ||
| self.ref = Container(resource: Resource.urlRequest(urlRequest), processors: processors, priority: priority, options: options) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 133 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 133 characters (line_length)
| self.metrics = ImageTaskMetrics.SessionMetrics(sessionId: sessionId) | ||
| self.priority = Property(value: request.priority) | ||
| } | ||
| func imageDataLoadingTask(_ task: OriginalImageDataTask, context: OriginalImageDataTaskContext, didFinishLoadingDataWithError error: Swift.Error?) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 152 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 152 characters (line_length)
|
|
||
| // Metrics that we collect during the lifetime of a session. | ||
| let metrics: ImageTaskMetrics.SessionMetrics | ||
| let progress = TaskProgress(completed: Int64(context.data.count), total: response.expectedContentLength + context.resumedDataCount) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 139 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 139 characters (line_length)
| var decoder: ImageDecoding? | ||
| var decodedFinalImage: ImageContainer? // Decoding result | ||
| weak var decodingOperation: Foundation.Operation? | ||
| func imageDataLoadingTask(_ task: OriginalImageDataTask, context: OriginalImageDataTaskContext, didReceiveData chunk: Data, response: URLResponse, log: Log) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 162 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 162 characters (line_length)
| didReceiveData: { [weak self, weak task] data, response in | ||
| guard let self = self, let task = task else { return } | ||
| self.queue.async { | ||
| self.imageDataLoadingTask(task, context: context, didReceiveData: data, response: response, log: log) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 121 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 121 characters (line_length)
|
|
||
| // MARK: - ImageLoadingSession | ||
| let log = Log(self.log, "Load Image Data") | ||
| log.signpost(.begin, "URL: \(urlRequest.url?.absoluteString ?? ""), resumable data: \(Log.bytes(context.resumableData?.data.count ?? 0))") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 146 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 146 characters (line_length)
| } | ||
|
|
||
| // MARK: Errors | ||
| // This methods gets called inside data loading operation (Operation). | ||
| func loadImageData(for task: OriginalImageDataTask, context: OriginalImageDataTaskContext, finish: @escaping () -> Void) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 126 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 126 characters (line_length)
| }) | ||
| } | ||
|
|
||
| func decodeData(_ data: Data, urlResponse: URLResponse?, isCompleted: Bool, task: OriginalImageTask, context: OriginalImageTaskContext) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 141 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 141 characters (line_length)
| let context = OriginalImageTaskContext(request: request) | ||
| task.dependency = self.getOriginalImageData(for: request) | ||
| .subscribe(task) { [weak self] value, isCompleted, task in | ||
| self?.decodeData(value.0, urlResponse: value.1, isCompleted: isCompleted, task: task, context: context) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 123 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 123 characters (line_length)
| ResumableData.storeResumableData(resumableData, for: session.request.urlRequest) | ||
| let log = Log(self.log, "Process Image") | ||
| log.signpost(.begin, "\(processor), \(isCompleted ? "final" : "progressive") image") | ||
| let context = ImageProcessingContext(request: request, isFinal: isCompleted, scanNumber: response.scanNumber) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 121 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 121 characters (line_length)
| // Return the existing processor in case it has already been created. | ||
| if let decoder = session.decoder { | ||
| return decoder | ||
| func processImage(_ response: ImageResponse, isCompleted: Bool, for request: ImageRequest, processor: ImageProcessing, task: ProcessedImageTask) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 150 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 150 characters (line_length)
| init(sessionId: Int) { self.sessionId = sessionId } | ||
|
|
||
| public var debugDescription: String { | ||
| return "Deprecated, please use os_signposts instead. For more info see `ImagePipeline.Configuration.isSignpostLoggingEnabled`" |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 138 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 138 characters (line_length)
| } | ||
|
|
||
| public var debugDescription: String { | ||
| return "Deprecated, please use os_signposts instead. For more info see `ImagePipeline.Configuration.isSignpostLoggingEnabled`" |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 134 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 134 characters (line_length)
| } | ||
| } | ||
|
|
||
| @available(*, deprecated, message: "Please use os_signposts instead. For more info see `ImagePipeline.Configuration.isSignpostLoggingEnabled`") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 143 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 143 characters (line_length)
| // MARK: - ImageTaskMetrics (Deprecated) | ||
|
|
||
| extension ImagePipeline { | ||
| @available(*, deprecated, message: "Please use os_signposts instead. For more info see `ImagePipeline.Configuration.isSignpostLoggingEnabled`") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 147 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 147 characters (line_length)
|
|
||
| // MARK: - AnyImageProcessor (Deprecated) | ||
|
|
||
| @available(*, deprecated, message: "The new `ImageProcessing` protocol now longer has Self requirement which were previously needed due to `Equatable`, `AnyImageProcessor` is no longer needed") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 193 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 193 characters (line_length)
| /// - parameter contentMode: An option for how to resize the image | ||
| /// to the target size. `.aspectFill` by default. | ||
| public init(targetSize: CGSize = MaximumSize, contentMode: ContentMode = .aspectFill, upscale: Bool = false) { | ||
| self.resize = ImageProcessor.Resize(size: targetSize, unit: .pixels, contentMode: .init(contentMode), upscale: upscale) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 127 characters (line_length)
| /// Decompressing compressed image formats (such as JPEG) can significantly | ||
| /// improve drawing performance as it allows a bitmap representation to be | ||
| /// created in a background rather than on the main thread. | ||
| @available(*, deprecated, message: "Decompression now runs automatically after all processors were applied and only if still needed. To disable decompression use `ImagePipeline.Configuration.isDecompressionEnabled`. If you were using `ImageDecompressor` to resize image please use `ImageProcessor.Resize`. Please be aware that the target size for `ImageProcessor.Resize` is in points by default, not pixels like in `ImageDecompressor`! For more info see https://github.com/kean/Nuke/pull/229.") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 494 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 494 characters (line_length)
|
|
||
| @available(*, deprecated, message: "Please use the new unified initializer `ImageRequest.init(urlRequest:processors:priority:options:)` with `ImageProcessor.Resize`instead. Target size for `ImageProcessor.Resize` is in points by default, not pixels! For more info see https://github.com/kean/Nuke/pull/229.") | ||
| public init(urlRequest: URLRequest, targetSize: CGSize, contentMode: ImageDecompressor.ContentMode, upscale: Bool = false) { | ||
| self.init(urlRequest: urlRequest, processor: ImageDecompressor(targetSize: targetSize, contentMode: contentMode, upscale: upscale)) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 139 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 139 characters (line_length)
| } | ||
|
|
||
| @available(*, deprecated, message: "Please use the new unified initializer `ImageRequest.init(urlRequest:processors:priority:options:)` with `ImageProcessor.Resize`instead. Target size for `ImageProcessor.Resize` is in points by default, not pixels! For more info see https://github.com/kean/Nuke/pull/229.") | ||
| public init(urlRequest: URLRequest, targetSize: CGSize, contentMode: ImageDecompressor.ContentMode, upscale: Bool = false) { |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 128 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 128 characters (line_length)
| self.init(url: url, processor: ImageDecompressor(targetSize: targetSize, contentMode: contentMode, upscale: upscale)) | ||
| } | ||
|
|
||
| @available(*, deprecated, message: "Please use the new unified initializer `ImageRequest.init(urlRequest:processors:priority:options:)` with `ImageProcessor.Resize`instead. Target size for `ImageProcessor.Resize` is in points by default, not pixels! For more info see https://github.com/kean/Nuke/pull/229.") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 312 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 312 characters (line_length)
| set { options.loadKey = newValue } | ||
| } | ||
|
|
||
| @available(*, deprecated, message: "Please use `ImageRequestOptions` instead, it now contains all the advanced options") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)
| set { options.cacheKey = newValue } | ||
| } | ||
|
|
||
| @available(*, deprecated, message: "Please use `ImageRequestOptions` instead, it now contains all the advanced options") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)
| set { options.memoryCacheOptions = newValue } | ||
| } | ||
|
|
||
| @available(*, deprecated, message: "Please use `ImageRequestOptions` instead, it now contains all the advanced options") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)
| } | ||
| } | ||
|
|
||
| @available(*, deprecated, message: "Please use `ImageRequestOptions` instead, it now contains all the advanced options") |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)
| /// Allows you to tap into internal events of the data loader. Events are | ||
| /// delivered on the internal serial operation queue. | ||
| public protocol DataLoaderObserving { | ||
| func dataLoader(_ loader: DataLoader, urlSession: URLSession, dataTask: URLSessionDataTask, didReceiveEvent event: DataTaskEvent) |
houndci-bot
Apr 17, 2020
Line Length Violation: Line should be 120 characters or less: currently 133 characters (line_length)
Line Length Violation: Line should be 120 characters or less: currently 133 characters (line_length)
@RocketChat/ios
Closes #ISSUE_NUMBER