Browse Source

remove some trailing whitespace warnings that I fixed en passant

cyberta 5 years ago
parent
commit
e4607b6d86

+ 12 - 14
deltachat-ios/Extensions/UIView+Extensions.swift

@@ -132,7 +132,7 @@ internal extension UIView {
     func constraintWitdthTo(_ width: CGFloat) -> NSLayoutConstraint {
        return  widthAnchor.constraint(equalToConstant: width)
     }
-    
+
     func fillSuperview() {
         guard let superview = self.superview else {
             return
@@ -143,8 +143,7 @@ internal extension UIView {
     	    leftAnchor.constraint(equalTo: superview.leftAnchor),
     	    rightAnchor.constraint(equalTo: superview.rightAnchor),
     	    topAnchor.constraint(equalTo: superview.topAnchor),
-    	    bottomAnchor.constraint(equalTo: superview.bottomAnchor)
-    	    ]
+    	    bottomAnchor.constraint(equalTo: superview.bottomAnchor)]
 	    NSLayoutConstraint.activate(constraints)
     }
 
@@ -159,7 +158,7 @@ internal extension UIView {
         ]
         NSLayoutConstraint.activate(constraints)
     }
-    
+
     func constraint(equalTo size: CGSize) {
         guard superview != nil else { return }
         translatesAutoresizingMaskIntoConstraints = false
@@ -168,37 +167,36 @@ internal extension UIView {
             heightAnchor.constraint(equalToConstant: size.height)
         ]
         NSLayoutConstraint.activate(constraints)
-        
+
     }
 
     @discardableResult
     internal func addConstraints(_ top: NSLayoutYAxisAnchor? = nil, left: NSLayoutXAxisAnchor? = nil, bottom: NSLayoutYAxisAnchor? = nil, right: NSLayoutXAxisAnchor? = nil, centerY: NSLayoutYAxisAnchor? = nil, centerX: NSLayoutXAxisAnchor? = nil, topConstant: CGFloat = 0, leftConstant: CGFloat = 0, bottomConstant: CGFloat = 0, rightConstant: CGFloat = 0, centerYConstant: CGFloat = 0, centerXConstant: CGFloat = 0, widthConstant: CGFloat = 0, heightConstant: CGFloat = 0) -> [NSLayoutConstraint] {
-        
+
         if self.superview == nil {
             return []
         }
         translatesAutoresizingMaskIntoConstraints = false
-        
+
         var constraints = [NSLayoutConstraint]()
-        
+
         if let top = top {
             let constraint = topAnchor.constraint(equalTo: top, constant: topConstant)
             constraint.identifier = "top"
             constraints.append(constraint)
         }
-        
         if let left = left {
             let constraint = leftAnchor.constraint(equalTo: left, constant: leftConstant)
             constraint.identifier = "left"
             constraints.append(constraint)
         }
-        
+
         if let bottom = bottom {
             let constraint = bottomAnchor.constraint(equalTo: bottom, constant: -bottomConstant)
             constraint.identifier = "bottom"
             constraints.append(constraint)
         }
-        
+
         if let right = right {
             let constraint = rightAnchor.constraint(equalTo: right, constant: -rightConstant)
             constraint.identifier = "right"
@@ -216,19 +214,19 @@ internal extension UIView {
             constraint.identifier = "centerX"
             constraints.append(constraint)
         }
-        
+
         if widthConstant > 0 {
             let constraint = widthAnchor.constraint(equalToConstant: widthConstant)
             constraint.identifier = "width"
             constraints.append(constraint)
         }
-        
+
         if heightConstant > 0 {
             let constraint = heightAnchor.constraint(equalToConstant: heightConstant)
             constraint.identifier = "height"
             constraints.append(constraint)
         }
-        
+
         NSLayoutConstraint.activate(constraints)
         return constraints
     }

+ 10 - 10
deltachat-ios/MessageKit/Layout/ContactMessageSizeCalculator.swift

@@ -26,45 +26,45 @@ import Foundation
 import UIKit
 
 open class ContactMessageSizeCalculator: MessageSizeCalculator {
-    
+
     public var incomingMessageNameLabelInsets = UIEdgeInsets(top: 7, left: 46, bottom: 7, right: 30)
     public var outgoingMessageNameLabelInsets = UIEdgeInsets(top: 7, left: 41, bottom: 7, right: 35)
     public var contactLabelFont = UIFont.preferredFont(forTextStyle: .body)
-    
+
     internal func contactLabelInsets(for message: MessageType) -> UIEdgeInsets {
         let dataSource = messagesLayout.messagesDataSource
         let isFromCurrentSender = dataSource.isFromCurrentSender(message: message)
         return isFromCurrentSender ? outgoingMessageNameLabelInsets : incomingMessageNameLabelInsets
     }
-    
+
     open override func messageContainerMaxWidth(for message: MessageType) -> CGFloat {
         let maxWidth = super.messageContainerMaxWidth(for: message)
         let textInsets = contactLabelInsets(for: message)
         return maxWidth - textInsets.horizontal
     }
-    
+
     open override func messageContainerSize(for message: MessageType) -> CGSize {
         let maxWidth = messageContainerMaxWidth(for: message)
-        
+
         var messageContainerSize: CGSize
         let attributedText: NSAttributedString
-        
+
         switch message.kind {
         case .contact(let item):
             attributedText = NSAttributedString(string: item.displayName, attributes: [.font: contactLabelFont])
         default:
             fatalError("messageContainerSize received unhandled MessageDataType: \(message.kind)")
         }
-        
+
         messageContainerSize = labelSize(for: attributedText, considering: maxWidth)
-        
+
         let messageInsets = contactLabelInsets(for: message)
         messageContainerSize.width += messageInsets.horizontal
         messageContainerSize.height += messageInsets.vertical
-        
+
         return messageContainerSize
     }
-    
+
     open override func configure(attributes: UICollectionViewLayoutAttributes) {
         super.configure(attributes: attributes)
         guard let attributes = attributes as? MessagesCollectionViewLayoutAttributes else { return }

+ 3 - 3
deltachat-ios/MessageKit/Layout/MessagesCollectionViewLayoutAttributes.swift

@@ -40,10 +40,10 @@ open class MessagesCollectionViewLayoutAttributes: UICollectionViewLayoutAttribu
 
     public var cellTopLabelAlignment = LabelAlignment(textAlignment: .center, textInsets: .zero)
     public var cellTopLabelSize: CGSize = .zero
-    
+
     public var cellBottomLabelAlignment = LabelAlignment(textAlignment: .center, textInsets: .zero)
     public var cellBottomLabelSize: CGSize = .zero
-    
+
     public var messageTopLabelAlignment = LabelAlignment(textAlignment: .center, textInsets: .zero)
     public var messageTopLabelSize: CGSize = .zero
 
@@ -53,7 +53,7 @@ open class MessagesCollectionViewLayoutAttributes: UICollectionViewLayoutAttribu
     public var accessoryViewSize: CGSize = .zero
     public var accessoryViewPadding: HorizontalEdgeInsets = .zero
     public var accessoryViewPosition: AccessoryPosition = .messageCenter
-    
+
     // MARK: - Methods
 
     open override func copy(with zone: NSZone? = nil) -> Any {

+ 5 - 5
deltachat-ios/MessageKit/Protocols/MessagesDataSource.swift

@@ -72,7 +72,7 @@ public protocol MessagesDataSource: AnyObject {
     ///
     /// The default value returned by this method is `nil`.
     func cellTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString?
-    
+
     /// The attributed text to be used for cell's bottom label.
     ///
     /// - Parameters:
@@ -82,7 +82,7 @@ public protocol MessagesDataSource: AnyObject {
     ///
     /// The default value returned by this method is `nil`.
     func cellBottomLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString?
-    
+
     /// The attributed text to be used for message bubble's top label.
     ///
     /// - Parameters:
@@ -136,11 +136,11 @@ public extension MessagesDataSource {
     func cellTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
         return nil
     }
-    
+
     func cellBottomLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
         return nil
     }
-    
+
     func messageTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
         return nil
     }
@@ -148,7 +148,7 @@ public extension MessagesDataSource {
     func messageBottomLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
         return nil
     }
-    
+
     func customCell(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> UICollectionViewCell {
         fatalError(MessageKitError.customDataUnresolvedCell)
     }

+ 3 - 3
deltachat-ios/MessageKit/Protocols/MessagesDisplayDelegate.swift

@@ -72,7 +72,7 @@ public protocol MessagesDisplayDelegate: AnyObject {
     ///   - indexPath: The `IndexPath` of the footer.
     ///   - messagesCollectionView: The `MessagesCollectionView` in which this footer will be displayed.
     func messageFooterView(for indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> MessageReusableView
-    
+
     /// Used to configure the `AvatarView`‘s image in a `MessageContentCell` class.
     ///
     /// - Parameters:
@@ -242,7 +242,7 @@ public extension MessagesDisplayDelegate {
     func messageFooterView(for indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> MessageReusableView {
         return messagesCollectionView.dequeueReusableFooterView(MessageReusableView.self, for: indexPath)
     }
-    
+
     func configureAvatarView(_ avatarView: AvatarView, for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) {
         avatarView.initials = "?"
     }
@@ -288,7 +288,7 @@ public extension MessagesDisplayDelegate {
     // MARK: - Audio Message Defaults
     
     func configureAudioCell(_ cell: AudioMessageCell, message: MessageType) {
-        
+
     }
 
     func audioTintColor(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> UIColor {

+ 23 - 24
deltachat-ios/MessageKit/Views/MessageLabel.swift

@@ -119,7 +119,7 @@ open class MessageLabel: UILabel {
         size.height += textInsets.vertical
         return size
     }
-    
+
     internal var messageLabelFont: UIFont?
 
     private var attributesNeedUpdate = false
@@ -139,11 +139,11 @@ open class MessageLabel: UILabel {
     open internal(set) var phoneNumberAttributes: [NSAttributedString.Key: Any] = defaultAttributes
 
     open internal(set) var urlAttributes: [NSAttributedString.Key: Any] = defaultAttributes
-    
+
     open internal(set) var transitInformationAttributes: [NSAttributedString.Key: Any] = defaultAttributes
-    
+
     open internal(set) var hashtagAttributes: [NSAttributedString.Key: Any] = defaultAttributes
-    
+
     open internal(set) var mentionAttributes: [NSAttributedString.Key: Any] = defaultAttributes
 
     open internal(set) var customAttributes: [NSRegularExpression: [NSAttributedString.Key: Any]] = [:]
@@ -201,7 +201,7 @@ open class MessageLabel: UILabel {
     }
 
     // MARK: - Public Methods
-    
+
     public func configure(block: () -> Void) {
         isConfiguring = true
         block()
@@ -222,19 +222,19 @@ open class MessageLabel: UILabel {
             setNeedsDisplay()
             return
         }
-        
+
         let style = paragraphStyle(for: newText)
         let range = NSRange(location: 0, length: newText.length)
-        
+
         let mutableText = NSMutableAttributedString(attributedString: newText)
         mutableText.addAttribute(.paragraphStyle, value: style, range: range)
-        
+
         if shouldParse {
             rangesForDetectors.removeAll()
             let results = parse(text: mutableText)
             setRangesForDetectors(in: results)
         }
-        
+
         for (detector, rangeTuples) in rangesForDetectors {
             if enabledDetectors.contains(detector) {
                 let attributes = detectorAttributes(for: detector)
@@ -250,17 +250,17 @@ open class MessageLabel: UILabel {
         if !isConfiguring { setNeedsDisplay() }
 
     }
-    
+
     private func paragraphStyle(for text: NSAttributedString) -> NSParagraphStyle {
         guard text.length > 0 else { return NSParagraphStyle() }
-        
+
         var range = NSRange(location: 0, length: text.length)
         let existingStyle = text.attribute(.paragraphStyle, at: 0, effectiveRange: &range) as? NSMutableParagraphStyle
         let style = existingStyle ?? NSMutableParagraphStyle()
-        
+
         style.lineBreakMode = lineBreakMode
         style.alignment = textAlignment
-        
+
         return style
     }
 
@@ -321,7 +321,7 @@ open class MessageLabel: UILabel {
             fatalError(MessageKitError.unrecognizedCheckingResult)
         }
     }
-    
+
     private func setupView() {
         numberOfLines = 0
         lineBreakMode = .byWordWrapping
@@ -378,7 +378,7 @@ open class MessageLabel: UILabel {
     private func setRangesForDetectors(in checkingResults: [NSTextCheckingResult]) {
 
         guard checkingResults.isEmpty == false else { return }
-        
+
         for result in checkingResults {
 
             switch result.resultType {
@@ -435,13 +435,13 @@ open class MessageLabel: UILabel {
         let index = layoutManager.glyphIndex(for: location, in: textContainer)
 
         let lineRect = layoutManager.lineFragmentUsedRect(forGlyphAt: index, effectiveRange: nil)
-        
+
         var characterIndex: Int?
-        
+
         if lineRect.contains(location) {
             characterIndex = layoutManager.characterIndexForGlyph(at: index)
         }
-        
+
         return characterIndex
 
     }
@@ -463,7 +463,6 @@ open class MessageLabel: UILabel {
 
     // swiftlint:disable cyclomatic_complexity
     private func handleGesture(for detectorType: DetectorType, value: MessageTextCheckingType) {
-        
         switch value {
         case let .addressComponents(addressComponents):
             var transformedAddressComponents = [String: String]()
@@ -501,23 +500,23 @@ open class MessageLabel: UILabel {
         }
     }
     // swiftlint:enable cyclomatic_complexity
-    
+
     private func handleAddress(_ addressComponents: [String: String]) {
         delegate?.didSelectAddress(addressComponents)
     }
-    
+
     private func handleDate(_ date: Date) {
         delegate?.didSelectDate(date)
     }
-    
+
     private func handleURL(_ url: URL) {
         delegate?.didSelectURL(url)
     }
-    
+
     private func handlePhoneNumber(_ phoneNumber: String) {
         delegate?.didSelectPhoneNumber(phoneNumber)
     }
-    
+
     private func handleTransitInformation(_ components: [String: String]) {
         delegate?.didSelectTransitInformation(components)
     }