- }
- var dLat = transformLatWithX(x: lon - 105.0, y: lat - 35.0)
- var dLon = transformLonWithY(x: lon - 105.0, y: lat - 35.0)
- let radLat = lat / 180.0 * .pi
- var magic = sin(radLat)
- magic = 1 - ee * magic * magic
- let sqrtMagic = sqrt(magic)
- dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * .pi)
- dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * .pi)
- return CLLocationCoordinate2DMake(dLat + coordinate.latitude, dLon + coordinate.longitude)
- }
-
- //judge china
-    public func outOfChina() -> Bool {
              -        guard case 72.005..<137.8347 = coordinate.longitude else {
              - return true
- }
-        guard case 0.8293..<55.8271 = coordinate.latitude else {
              - return true
- }
- return false
- }
-
-    public func transformLatWithX(x: Double, y: Double) -> Double {
              - var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * sqrt(abs(x))
- ret += (20.0 * sin(6.0 * x * .pi) + 20.0 * sin(2.0 * x * .pi)) * 2.0 / 3.0
- ret += (20.0 * sin(y * .pi) + 40.0 * sin(y / 3.0 * .pi)) * 2.0 / 3.0
- ret += (160.0 * sin(y / 12.0 * .pi) + 320.0 * sin(y * .pi / 30.0)) * 2.0 / 3.0
- return ret
- }
-
-    public func transformLonWithY(x: Double, y: Double) -> Double {
              - var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * sqrt(abs(x))
- ret += (20.0 * sin(6.0 * x * .pi) + 20.0 * sin(2.0 * x * .pi)) * 2.0 / 3.0
- ret += (20.0 * sin(x * .pi) + 40.0 * sin(x / 3.0 * .pi)) * 2.0 / 3.0
- ret += (150.0 * sin(x / 12.0 * .pi) + 300.0 * sin(x / 30.0 * .pi)) * 2.0 / 3.0
- return ret
- }
-}
                @@ -10,8 +10,9 @@ import UIKit  | 
            ||
| 10 | 10 | 
                 | 
            
| 11 | 11 | 
                 extension UIColor {
               | 
            
| 12 | 12 | 
                 | 
            
| 13 | 
                -    public convenience init(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat = 1) {
               | 
            |
| 14 | 
                - self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: a)  | 
            |
| 13 | 
                + //swiftlint:disable identifier_name  | 
            |
| 14 | 
                +    public convenience init(r: CGFloat, g: CGFloat, b: CGFloat, alpha: CGFloat = 1) {
               | 
            |
| 15 | 
                + self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: alpha)  | 
            |
| 15 | 16 | 
                }  | 
            
| 16 | 17 | 
                 | 
            
| 17 | 18 | 
                     public convenience init?(hexString: String, alpha: CGFloat = 1.0) {
               | 
            
                @@ -26,8 +27,8 @@ extension UIColor {
               | 
            ||
| 26 | 27 | 
                self.init(red: red, green: green, blue: blue, alpha: alpha)  | 
            
| 27 | 28 | 
                }  | 
            
| 28 | 29 | 
                 | 
            
| 29 | 
                -    public convenience init(gray: CGFloat, a: CGFloat = 1) {
               | 
            |
| 30 | 
                - self.init(red: gray / 255.0, green: gray / 255.0, blue: gray / 255.0, alpha: a)  | 
            |
| 30 | 
                +    public convenience init(gray: CGFloat, alpha: CGFloat = 1) {
               | 
            |
| 31 | 
                + self.init(red: gray / 255.0, green: gray / 255.0, blue: gray / 255.0, alpha: alpha)  | 
            |
| 31 | 32 | 
                }  | 
            
| 32 | 33 | 
                 | 
            
| 33 | 34 | 
                }  | 
            
                @@ -149,12 +149,11 @@ extension UIView {
               | 
            ||
| 149 | 149 | 
                 | 
            
| 150 | 150 | 
                 extension UIView {
               | 
            
| 151 | 151 | 
                     func getSuperViewController() -> UIViewController? {
               | 
            
| 152 | 
                - var nr = next  | 
            |
| 153 | 
                -        while let r = nr {
               | 
            |
| 154 | 
                -            if let vc = r as? UIViewController { return vc }
               | 
            |
| 155 | 
                - nr = r.next  | 
            |
| 152 | 
                + var nextResp = next  | 
            |
| 153 | 
                +        while let resp = nextResp {
               | 
            |
| 154 | 
                +            if let vc = resp as? UIViewController { return vc }
               | 
            |
| 155 | 
                + nextResp = resp.next  | 
            |
| 156 | 156 | 
                }  | 
            
| 157 | 
                -  | 
            |
| 158 | 157 | 
                return nil  | 
            
| 159 | 158 | 
                }  | 
            
| 160 | 159 | 
                }  | 
            
                @@ -50,7 +50,7 @@ open class AlertViewController: UIViewController, PresentViewController {
               | 
            ||
| 50 | 50 | 
                 | 
            
| 51 | 51 | 
                     override open func viewDidLoad() {
               | 
            
| 52 | 52 | 
                super.viewDidLoad()  | 
            
| 53 | 
                - view.backgroundColor = UIColor(gray: 52, a: 0)  | 
            |
| 53 | 
                + view.backgroundColor = UIColor(gray: 52, alpha: 0)  | 
            |
| 54 | 54 | 
                configurationGestures()  | 
            
| 55 | 55 | 
                 | 
            
| 56 | 56 | 
                }  | 
            
                @@ -1,121 +0,0 @@  | 
            ||
| 1 | 
                -//  | 
            |
| 2 | 
                -// ActionSheetView.swift  | 
            |
| 3 | 
                -// PaiaiUIKit  | 
            |
| 4 | 
                -//  | 
            |
| 5 | 
                -// Created by FFIB on 2017/11/17.  | 
            |
| 6 | 
                -// Copyright © 2017年 FFIB. All rights reserved.  | 
            |
| 7 | 
                -//  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -import UIKit  | 
            |
| 10 | 
                -  | 
            |
| 11 | 
                -public final class ActionSheetView: UIView {
               | 
            |
| 12 | 
                -    public static var `default`: ActionSheetView {
               | 
            |
| 13 | 
                - return ActionSheetView()  | 
            |
| 14 | 
                - }  | 
            |
| 15 | 
                -  | 
            |
| 16 | 
                - private typealias ButtonAction = ((AlertAction) -> Void)  | 
            |
| 17 | 
                -  | 
            |
| 18 | 
                - public private(set) var alertActions: [AlertAction] = []  | 
            |
| 19 | 
                - public private(set) var cancelAction: AlertAction?  | 
            |
| 20 | 
                - private var _cancelItem: AlertItem?  | 
            |
| 21 | 
                - private var _alertItems: [AlertItem] = []  | 
            |
| 22 | 
                -  | 
            |
| 23 | 
                - private var actions: [ButtonAction] = []  | 
            |
| 24 | 
                - private var viewNotReady = true  | 
            |
| 25 | 
                -  | 
            |
| 26 | 
                - var title: String = ""  | 
            |
| 27 | 
                - var message: String = ""  | 
            |
| 28 | 
                -  | 
            |
| 29 | 
                -    override public func didMoveToWindow() {
               | 
            |
| 30 | 
                - super.didMoveToWindow()  | 
            |
| 31 | 
                -        guard viewNotReady else { return }
               | 
            |
| 32 | 
                - constructViewHierarchy()  | 
            |
| 33 | 
                - activateConstraints()  | 
            |
| 34 | 
                - backgroundColor = UIColor(r: 153, g: 153, b: 153)  | 
            |
| 35 | 
                - viewNotReady = false  | 
            |
| 36 | 
                - }  | 
            |
| 37 | 
                -  | 
            |
| 38 | 
                -    private func constructViewHierarchy() {
               | 
            |
| 39 | 
                -        for item in _alertItems { addSubview(item) }
               | 
            |
| 40 | 
                -  | 
            |
| 41 | 
                -        guard let item = _cancelItem else { return }
               | 
            |
| 42 | 
                - addSubview(item)  | 
            |
| 43 | 
                - }  | 
            |
| 44 | 
                -  | 
            |
| 45 | 
                -    private func activateConstraints() {
               | 
            |
| 46 | 
                - activateConstraintsCancelItem()  | 
            |
| 47 | 
                - activateConstraintsItems()  | 
            |
| 48 | 
                - activateConstraintsRootView()  | 
            |
| 49 | 
                - }  | 
            |
| 50 | 
                -  | 
            |
| 51 | 
                -    func addAlertAction(_ action: AlertAction) {
               | 
            |
| 52 | 
                -        switch action.style {
               | 
            |
| 53 | 
                - case .default, .custom:  | 
            |
| 54 | 
                - alertActions.append(action)  | 
            |
| 55 | 
                - _alertItems.append(action.style.item)  | 
            |
| 56 | 
                - case .cancel:  | 
            |
| 57 | 
                - cancelAction = action  | 
            |
| 58 | 
                - _cancelItem = action.style.item  | 
            |
| 59 | 
                - }  | 
            |
| 60 | 
                - }  | 
            |
| 61 | 
                -}  | 
            |
| 62 | 
                -  | 
            |
| 63 | 
                -/// MARK:  | 
            |
| 64 | 
                -fileprivate extension ActionSheetView {
               | 
            |
| 65 | 
                -    func activateConstraintsRootView() {
               | 
            |
| 66 | 
                -        guard let v = superview else { return }
               | 
            |
| 67 | 
                - translatesAutoresizingMaskIntoConstraints = false  | 
            |
| 68 | 
                -  | 
            |
| 69 | 
                - NSLayoutConstraint.activate([  | 
            |
| 70 | 
                - bottomAnchor.constraint(equalTo: v.bottomAnchor),  | 
            |
| 71 | 
                - leadingAnchor.constraint(equalTo: v.leadingAnchor),  | 
            |
| 72 | 
                - trailingAnchor.constraint(equalTo: v.trailingAnchor)  | 
            |
| 73 | 
                - ])  | 
            |
| 74 | 
                - }  | 
            |
| 75 | 
                -  | 
            |
| 76 | 
                -    func activateConstraintsCancelItem() {
               | 
            |
| 77 | 
                - guard let alertAction = cancelAction,  | 
            |
| 78 | 
                -            let cancelItem = _cancelItem else { return }
               | 
            |
| 79 | 
                - cancelItem.translatesAutoresizingMaskIntoConstraints = false  | 
            |
| 80 | 
                - cancelItem.setAttributedTitle(alertAction.attributedTitle, for: .normal)  | 
            |
| 81 | 
                -  | 
            |
| 82 | 
                - NSLayoutConstraint.activate([  | 
            |
| 83 | 
                - cancelItem.heightAnchor.constraint(equalToConstant: 44),  | 
            |
| 84 | 
                - cancelItem.leadingAnchor.constraint(equalTo: leadingAnchor),  | 
            |
| 85 | 
                - cancelItem.trailingAnchor.constraint(equalTo: trailingAnchor),  | 
            |
| 86 | 
                - cancelItem.bottomAnchor.constraint(equalTo: bottomAnchor)  | 
            |
| 87 | 
                - ])  | 
            |
| 88 | 
                - }  | 
            |
| 89 | 
                -  | 
            |
| 90 | 
                -    func activateConstraintsItems() {
               | 
            |
| 91 | 
                -        guard !alertActions.isEmpty else { return }
               | 
            |
| 92 | 
                - var last: UIButton? = _cancelItem  | 
            |
| 93 | 
                - var bottom: CGFloat = _cancelItem == nil ? 0 : -6  | 
            |
| 94 | 
                -        for (alertAction, item) in zip(alertActions, _alertItems).reversed() {
               | 
            |
| 95 | 
                - item.translatesAutoresizingMaskIntoConstraints = false  | 
            |
| 96 | 
                - item.setAttributedTitle(alertAction.attributedTitle, for: .normal)  | 
            |
| 97 | 
                - NSLayoutConstraint.activate([  | 
            |
| 98 | 
                - item.heightAnchor.constraint(equalToConstant: 44),  | 
            |
| 99 | 
                - item.leadingAnchor.constraint(equalTo: leadingAnchor),  | 
            |
| 100 | 
                - item.trailingAnchor.constraint(equalTo: trailingAnchor),  | 
            |
| 101 | 
                - item.bottomAnchor.constraint(equalTo: last?.topAnchor ?? bottomAnchor, constant: bottom)  | 
            |
| 102 | 
                - ])  | 
            |
| 103 | 
                - last = item  | 
            |
| 104 | 
                - bottom = -1  | 
            |
| 105 | 
                - }  | 
            |
| 106 | 
                - NSLayoutConstraint.activate([topAnchor.constraint(equalTo: last!.topAnchor)])  | 
            |
| 107 | 
                - }  | 
            |
| 108 | 
                -}  | 
            |
| 109 | 
                -  | 
            |
| 110 | 
                -fileprivate extension AlertAction.Style {
               | 
            |
| 111 | 
                -    var item: AlertItem {
               | 
            |
| 112 | 
                -        switch self {
               | 
            |
| 113 | 
                - case .cancel:  | 
            |
| 114 | 
                - return BottomCancelItem()  | 
            |
| 115 | 
                - case .default:  | 
            |
| 116 | 
                - return BottomDefaultItem()  | 
            |
| 117 | 
                - case let .custom(v):  | 
            |
| 118 | 
                - return v  | 
            |
| 119 | 
                - }  | 
            |
| 120 | 
                - }  | 
            |
| 121 | 
                -}  | 
            
                @@ -1,78 +0,0 @@  | 
            ||
| 1 | 
                -//  | 
            |
| 2 | 
                -// AES.swift  | 
            |
| 3 | 
                -// PaiAi  | 
            |
| 4 | 
                -//  | 
            |
| 5 | 
                -// Created by LISA on 2017/6/1.  | 
            |
| 6 | 
                -// Copyright © 2017年 yb. All rights reserved.  | 
            |
| 7 | 
                -//  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -import UIKit  | 
            |
| 10 | 
                -  | 
            |
| 11 | 
                -private let key = "i29g8au38U3dI8dj"  | 
            |
| 12 | 
                -private let iv = "a2k49g8wJ3F3kf9k"  | 
            |
| 13 | 
                -// MARK: AES  | 
            |
| 14 | 
                -extension Data {
               | 
            |
| 15 | 
                -    fileprivate func AES(operation: CCOperation, key: String, iv: String) -> Data? {
               | 
            |
| 16 | 
                - var digest_length = Swift.max(self.count * 2, 16)  | 
            |
| 17 | 
                - var digest = [UInt8](repeating: 0, count: digest_length)  | 
            |
| 18 | 
                -  | 
            |
| 19 | 
                - //AES encrypt  | 
            |
| 20 | 
                - let status = CCCrypt(operation, CCAlgorithm(kCCAlgorithmAES128),  | 
            |
| 21 | 
                - CCOptions(kCCOptionPKCS7Padding),  | 
            |
| 22 | 
                - key.bytes, key.lengthOfBytes(using: .utf8),  | 
            |
| 23 | 
                - iv.bytes,  | 
            |
| 24 | 
                - self.arrayOfBytes(), self.arrayOfBytes().count,  | 
            |
| 25 | 
                - &digest, digest.count, &digest_length)  | 
            |
| 26 | 
                -  | 
            |
| 27 | 
                -        if status == CCCryptorStatus(kCCSuccess) {
               | 
            |
| 28 | 
                - return Data(bytes: digest, count: digest_length)  | 
            |
| 29 | 
                - }  | 
            |
| 30 | 
                - return nil  | 
            |
| 31 | 
                - }  | 
            |
| 32 | 
                -  | 
            |
| 33 | 
                -    func AES128EncryptToData() -> Data {
               | 
            |
| 34 | 
                - return self.AES(operation: CCOperation(kCCEncrypt), key: key, iv: iv)!  | 
            |
| 35 | 
                - }  | 
            |
| 36 | 
                -    func AES128EncryptToBase64Data() -> Data {
               | 
            |
| 37 | 
                - return self.AES128EncryptToData().base64EncodedData()  | 
            |
| 38 | 
                - }  | 
            |
| 39 | 
                -    func AES128EncryptToBase64String() -> String {
               | 
            |
| 40 | 
                - return self.AES128EncryptToData().base64EncodedString()  | 
            |
| 41 | 
                - }  | 
            |
| 42 | 
                -    func AES128DecryptFromBase64DataToData() -> Data {
               | 
            |
| 43 | 
                - return Data(base64Encoded: self)!.AES128DecryptToData()  | 
            |
| 44 | 
                - }  | 
            |
| 45 | 
                -    func AES128DecryptFromBase64DataToString() -> String {
               | 
            |
| 46 | 
                - return Data(base64Encoded: self)!.AES128DecryptToString()  | 
            |
| 47 | 
                - }  | 
            |
| 48 | 
                -    func AES128DecryptToData() -> Data {
               | 
            |
| 49 | 
                - return self.AES(operation: CCOperation(kCCDecrypt), key: key, iv: iv)!  | 
            |
| 50 | 
                - }  | 
            |
| 51 | 
                -    func AES128DecryptToString() -> String {
               | 
            |
| 52 | 
                - return String.init(data: self.AES128DecryptToData(), encoding: String.Encoding.utf8) ?? ""  | 
            |
| 53 | 
                - }  | 
            |
| 54 | 
                -}  | 
            |
| 55 | 
                -  | 
            |
| 56 | 
                -extension String {
               | 
            |
| 57 | 
                -  | 
            |
| 58 | 
                -    func AES128EncryptToData() -> Data {
               | 
            |
| 59 | 
                -  | 
            |
| 60 | 
                - return self.myData.AES128EncryptToData()  | 
            |
| 61 | 
                - }  | 
            |
| 62 | 
                -    func AES128EncryptToBase64Data() -> Data {
               | 
            |
| 63 | 
                -  | 
            |
| 64 | 
                - return self.myData.AES128EncryptToBase64Data()  | 
            |
| 65 | 
                - }  | 
            |
| 66 | 
                -    func AES128EncryptToBase64String() -> String {
               | 
            |
| 67 | 
                -  | 
            |
| 68 | 
                - return self.myData.AES128EncryptToBase64String()  | 
            |
| 69 | 
                - }  | 
            |
| 70 | 
                -  | 
            |
| 71 | 
                -    func AES128DecryptFromBase64StringToData() -> Data {
               | 
            |
| 72 | 
                - return (Data(base64Encoded: self)?.AES128DecryptToData())!  | 
            |
| 73 | 
                - }  | 
            |
| 74 | 
                -  | 
            |
| 75 | 
                -    func AES128DecryptFromBase64StringToString() -> String {
               | 
            |
| 76 | 
                - return (Data(base64Encoded: self)?.AES128DecryptToString())!  | 
            |
| 77 | 
                - }  | 
            |
| 78 | 
                -}  | 
            
                @@ -1,17 +0,0 @@  | 
            ||
| 1 | 
                -//  | 
            |
| 2 | 
                -// Data+bytes.swift  | 
            |
| 3 | 
                -// PaiAi  | 
            |
| 4 | 
                -//  | 
            |
| 5 | 
                -// Created by LISA on 2017/6/1.  | 
            |
| 6 | 
                -// Copyright © 2017年 yb. All rights reserved.  | 
            |
| 7 | 
                -//  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -import UIKit  | 
            |
| 10 | 
                -extension Data {
               | 
            |
| 11 | 
                -    public func arrayOfBytes() -> [UInt8] {
               | 
            |
| 12 | 
                - let count = self.count / MemoryLayout<UInt8>.size  | 
            |
| 13 | 
                - var bytesArray = [UInt8](repeating: 0, count: count)  | 
            |
| 14 | 
                - (self as NSData).getBytes(&bytesArray, length: count * MemoryLayout<UInt8>.size)  | 
            |
| 15 | 
                - return bytesArray  | 
            |
| 16 | 
                - }  | 
            |
| 17 | 
                -}  | 
            
                @@ -1,116 +0,0 @@  | 
            ||
| 1 | 
                -//  | 
            |
| 2 | 
                -// Digest.swift  | 
            |
| 3 | 
                -// PaiAi  | 
            |
| 4 | 
                -//  | 
            |
| 5 | 
                -// Created by LISA on 2017/6/1.  | 
            |
| 6 | 
                -// Copyright © 2017年 yb. All rights reserved.  | 
            |
| 7 | 
                -//  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -import UIKit  | 
            |
| 10 | 
                -  | 
            |
| 11 | 
                -enum EncryptionAlgorithm: CC_LONG {
               | 
            |
| 12 | 
                -// case md2 = 16  | 
            |
| 13 | 
                -// case md4 = 17  | 
            |
| 14 | 
                - case md5 = 16  | 
            |
| 15 | 
                - case sha1 = 20  | 
            |
| 16 | 
                - case sha224 = 28  | 
            |
| 17 | 
                - case sha256 = 32  | 
            |
| 18 | 
                - case sha384 = 48  | 
            |
| 19 | 
                - case sha512 = 64  | 
            |
| 20 | 
                -  | 
            |
| 21 | 
                -}  | 
            |
| 22 | 
                -  | 
            |
| 23 | 
                -extension Data {
               | 
            |
| 24 | 
                -    public var bytes: UnsafePointer<UInt8> {
               | 
            |
| 25 | 
                -        return self.withUnsafeBytes({ (pointer: UnsafePointer<UInt8>) -> UnsafePointer<UInt8> in
               | 
            |
| 26 | 
                - return pointer  | 
            |
| 27 | 
                - })  | 
            |
| 28 | 
                - }  | 
            |
| 29 | 
                -}  | 
            |
| 30 | 
                -  | 
            |
| 31 | 
                -// MARK: md and sha  | 
            |
| 32 | 
                -extension Data {
               | 
            |
| 33 | 
                -  | 
            |
| 34 | 
                -    fileprivate func digestAlgorithm(algorithm: EncryptionAlgorithm) ->UnsafeMutablePointer<CUnsignedChar> {
               | 
            |
| 35 | 
                - let strlen = CC_LONG(16)  | 
            |
| 36 | 
                -        switch algorithm {
               | 
            |
| 37 | 
                -// case .md2:  | 
            |
| 38 | 
                -// let digest = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: Int(CC_MD2_DIGEST_LENGTH))  | 
            |
| 39 | 
                -// CC_MD2(self.bytes, strlen, digest)  | 
            |
| 40 | 
                -// return digest  | 
            |
| 41 | 
                -// case .md4:  | 
            |
| 42 | 
                -// let digest = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: Int(CC_MD4_DIGEST_LENGTH))  | 
            |
| 43 | 
                -// CC_MD4(self.bytes, strlen, digest)  | 
            |
| 44 | 
                -// return digest  | 
            |
| 45 | 
                - case .md5:  | 
            |
| 46 | 
                - let digest = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: Int(CC_MD5_DIGEST_LENGTH))  | 
            |
| 47 | 
                - CC_MD5(self.bytes, strlen, digest)  | 
            |
| 48 | 
                - return digest  | 
            |
| 49 | 
                - case .sha1:  | 
            |
| 50 | 
                - let digest = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: Int(CC_SHA1_DIGEST_LENGTH))  | 
            |
| 51 | 
                - CC_SHA1(self.bytes, strlen, digest)  | 
            |
| 52 | 
                - return digest  | 
            |
| 53 | 
                - case .sha224:  | 
            |
| 54 | 
                - let digest = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: Int(CC_SHA224_DIGEST_LENGTH))  | 
            |
| 55 | 
                - CC_SHA224(self.bytes, strlen, digest)  | 
            |
| 56 | 
                - return digest  | 
            |
| 57 | 
                - case .sha256:  | 
            |
| 58 | 
                - let digest = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: Int(CC_SHA256_DIGEST_LENGTH))  | 
            |
| 59 | 
                - CC_SHA256(self.bytes, strlen, digest)  | 
            |
| 60 | 
                - return digest  | 
            |
| 61 | 
                - case .sha384:  | 
            |
| 62 | 
                - let digest = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: Int(CC_SHA384_DIGEST_LENGTH))  | 
            |
| 63 | 
                - CC_SHA384(self.bytes, strlen, digest)  | 
            |
| 64 | 
                - return digest  | 
            |
| 65 | 
                - case .sha512:  | 
            |
| 66 | 
                - let digest = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: Int(CC_SHA512_DIGEST_LENGTH))  | 
            |
| 67 | 
                - CC_SHA512(self.bytes, strlen, digest)  | 
            |
| 68 | 
                - return digest  | 
            |
| 69 | 
                - }  | 
            |
| 70 | 
                - }  | 
            |
| 71 | 
                -  | 
            |
| 72 | 
                - //return the string  | 
            |
| 73 | 
                -    func digestString(algorithm: EncryptionAlgorithm) -> String {
               | 
            |
| 74 | 
                - let length = algorithm.rawValue  | 
            |
| 75 | 
                - let digest = digestAlgorithm(algorithm: algorithm)  | 
            |
| 76 | 
                -  | 
            |
| 77 | 
                - var outStr = ""  | 
            |
| 78 | 
                -        for i in 0..<Int(length) {
               | 
            |
| 79 | 
                -            outStr = outStr.appendingFormat("%02x", digest[i])
               | 
            |
| 80 | 
                - }  | 
            |
| 81 | 
                - return outStr.uppercased()  | 
            |
| 82 | 
                - }  | 
            |
| 83 | 
                - //return the data  | 
            |
| 84 | 
                -    func digestData(algorithm: EncryptionAlgorithm) -> Data {
               | 
            |
| 85 | 
                - let str = digestString(algorithm: algorithm)  | 
            |
| 86 | 
                - return str.data(using: String.Encoding.utf8)!  | 
            |
| 87 | 
                - }  | 
            |
| 88 | 
                -  | 
            |
| 89 | 
                -    func digestBase64Data(algorithm: EncryptionAlgorithm) -> Data {
               | 
            |
| 90 | 
                - return digestData(algorithm: algorithm).base64EncodedData()  | 
            |
| 91 | 
                - }  | 
            |
| 92 | 
                -  | 
            |
| 93 | 
                -    func digestBase64String(algorithm: EncryptionAlgorithm) -> String {
               | 
            |
| 94 | 
                - return digestData(algorithm: algorithm).base64EncodedString()  | 
            |
| 95 | 
                - }  | 
            |
| 96 | 
                -}  | 
            |
| 97 | 
                -  | 
            |
| 98 | 
                -extension String {
               | 
            |
| 99 | 
                - //return the stringx  | 
            |
| 100 | 
                -    func digestString(algorithm: EncryptionAlgorithm) -> String {
               | 
            |
| 101 | 
                - return self.myData.digestString(algorithm: algorithm)  | 
            |
| 102 | 
                - }  | 
            |
| 103 | 
                - //return the data  | 
            |
| 104 | 
                -    func digestData(algorithm: EncryptionAlgorithm) -> Data {
               | 
            |
| 105 | 
                - return self.myData.digestData(algorithm: algorithm)  | 
            |
| 106 | 
                - }  | 
            |
| 107 | 
                -  | 
            |
| 108 | 
                -    func digestBase64Data(algorithm: EncryptionAlgorithm) -> Data {
               | 
            |
| 109 | 
                - return self.myData.digestBase64Data(algorithm: algorithm)  | 
            |
| 110 | 
                - }  | 
            |
| 111 | 
                -  | 
            |
| 112 | 
                -    func digestBase64String(algorithm: EncryptionAlgorithm) -> String {
               | 
            |
| 113 | 
                - return self.myData.digestBase64String(algorithm: algorithm)  | 
            |
| 114 | 
                -  | 
            |
| 115 | 
                - }  | 
            |
| 116 | 
                -}  | 
            
                @@ -1,128 +0,0 @@  | 
            ||
| 1 | 
                -//  | 
            |
| 2 | 
                -// Data+Encryption.swift  | 
            |
| 3 | 
                -// Function  | 
            |
| 4 | 
                -//  | 
            |
| 5 | 
                -// Created by mac on 2016/11/9.  | 
            |
| 6 | 
                -// Copyright © 2016年 mac. All rights reserved.  | 
            |
| 7 | 
                -//  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -import UIKit  | 
            |
| 10 | 
                -  | 
            |
| 11 | 
                -// MARK: RSA encrypt  | 
            |
| 12 | 
                -extension Data {
               | 
            |
| 13 | 
                -    fileprivate func rsa_publickey_form_data(keyData: Data) -> SecKey? {
               | 
            |
| 14 | 
                -        if let certificate = SecCertificateCreateWithData(kCFAllocatorDefault, keyData as CFData) {
               | 
            |
| 15 | 
                - let policy = SecPolicyCreateBasicX509()  | 
            |
| 16 | 
                - var trust: SecTrust?  | 
            |
| 17 | 
                -            if SecTrustCreateWithCertificates(certificate, policy, &trust) == errSecSuccess {
               | 
            |
| 18 | 
                - var trustResultType: SecTrustResultType = SecTrustResultType.invalid  | 
            |
| 19 | 
                -                if SecTrustEvaluate(trust!, &trustResultType) == errSecSuccess {
               | 
            |
| 20 | 
                - return SecTrustCopyPublicKey(trust!)!  | 
            |
| 21 | 
                - }  | 
            |
| 22 | 
                - }  | 
            |
| 23 | 
                - }  | 
            |
| 24 | 
                - return nil  | 
            |
| 25 | 
                - }  | 
            |
| 26 | 
                -  | 
            |
| 27 | 
                -    fileprivate func rsa_privatekey_from_data(keyData: Data, withPassword password: String) -> SecKey? {
               | 
            |
| 28 | 
                - var privateKey: SecKey?  | 
            |
| 29 | 
                - let options: [String: String] = [kSecImportExportPassphrase as String: password]  | 
            |
| 30 | 
                - var items: CFArray?  | 
            |
| 31 | 
                -        if SecPKCS12Import(keyData as CFData, options as CFDictionary, &items) == errSecSuccess {
               | 
            |
| 32 | 
                -            if CFArrayGetCount(items) > 0 {
               | 
            |
| 33 | 
                - let d = unsafeBitCast(CFArrayGetValueAtIndex(items, 0), to: CFDictionary.self)  | 
            |
| 34 | 
                - let k = Unmanaged.passUnretained(kSecImportItemIdentity).toOpaque()  | 
            |
| 35 | 
                - let v = CFDictionaryGetValue(d, k)  | 
            |
| 36 | 
                - let secIdentity = unsafeBitCast(v, to: SecIdentity.self)  | 
            |
| 37 | 
                -                if SecIdentityCopyPrivateKey(secIdentity, &privateKey) == errSecSuccess {
               | 
            |
| 38 | 
                - return privateKey  | 
            |
| 39 | 
                - }  | 
            |
| 40 | 
                - }  | 
            |
| 41 | 
                - }  | 
            |
| 42 | 
                - return nil  | 
            |
| 43 | 
                - }  | 
            |
| 44 | 
                -    fileprivate func RSA(operation: String, key: SecKey) -> Data? {
               | 
            |
| 45 | 
                - let key_size = SecKeyGetBlockSize(key)  | 
            |
| 46 | 
                - var encrypt_bytes = [UInt8](repeating: 0, count: key_size)  | 
            |
| 47 | 
                - var output_size = key_size  | 
            |
| 48 | 
                -        if operation == "encrypt" {
               | 
            |
| 49 | 
                - if SecKeyEncrypt(key, SecPadding.PKCS1,  | 
            |
| 50 | 
                - self.bytes, self.count,  | 
            |
| 51 | 
                -                             &encrypt_bytes, &output_size) == errSecSuccess {
               | 
            |
| 52 | 
                - return Data(bytes: encrypt_bytes, count: output_size)  | 
            |
| 53 | 
                - }  | 
            |
| 54 | 
                -        } else {
               | 
            |
| 55 | 
                - let stauts = SecKeyDecrypt(key, SecPadding.PKCS1,  | 
            |
| 56 | 
                - self.bytes, self.count,  | 
            |
| 57 | 
                - &encrypt_bytes, &output_size)  | 
            |
| 58 | 
                -            if stauts == errSecSuccess {
               | 
            |
| 59 | 
                - return Data(bytes: UnsafePointer<UInt8>(encrypt_bytes), count: output_size)  | 
            |
| 60 | 
                - }  | 
            |
| 61 | 
                - }  | 
            |
| 62 | 
                -  | 
            |
| 63 | 
                - return nil  | 
            |
| 64 | 
                - }  | 
            |
| 65 | 
                -  | 
            |
| 66 | 
                -    func RSAEncryptToData(publicKeyPath: String) -> Data {
               | 
            |
| 67 | 
                - let publicKey = try? Data(contentsOf: URL(fileURLWithPath: publicKeyPath))  | 
            |
| 68 | 
                - let publickeyData = rsa_publickey_form_data(keyData: publicKey!)  | 
            |
| 69 | 
                - return RSA(operation: "encrypt", key: publickeyData!)!  | 
            |
| 70 | 
                - }  | 
            |
| 71 | 
                -  | 
            |
| 72 | 
                -    func RSAEncryptToBase64Data(publicKeyPath: String) -> Data {
               | 
            |
| 73 | 
                - return RSAEncryptToData(publicKeyPath: publicKeyPath).base64EncodedData()  | 
            |
| 74 | 
                - }  | 
            |
| 75 | 
                -  | 
            |
| 76 | 
                -    func RSAEncryptToBase64String(publicKeyPath: String) -> String {
               | 
            |
| 77 | 
                - return RSAEncryptToData(publicKeyPath: publicKeyPath).base64EncodedString()  | 
            |
| 78 | 
                - }  | 
            |
| 79 | 
                -  | 
            |
| 80 | 
                -    mutating func RSADecryptFromBase64DataToData(privateKeyPath: String) -> Data {
               | 
            |
| 81 | 
                - self = Data.init(base64Encoded: self)!  | 
            |
| 82 | 
                - return RSADecryptToData(privateKeyPath: privateKeyPath)  | 
            |
| 83 | 
                - }  | 
            |
| 84 | 
                -    mutating func RSADecryptFromBase64DataToString(privateKeyPath: String) -> String {
               | 
            |
| 85 | 
                - self = Data.init(base64Encoded: self)!  | 
            |
| 86 | 
                - return RSADecryptToString(privateKeyPath: privateKeyPath)  | 
            |
| 87 | 
                - }  | 
            |
| 88 | 
                -  | 
            |
| 89 | 
                -    func RSADecryptToData(privateKeyPath: String) -> Data {
               | 
            |
| 90 | 
                - let privateKey = try? Data(contentsOf: URL(fileURLWithPath: privateKeyPath))  | 
            |
| 91 | 
                - let privateKeyData = rsa_privatekey_from_data(keyData: privateKey!, withPassword: "5995267")  | 
            |
| 92 | 
                - return RSA(operation: "decrypt", key: privateKeyData!)!  | 
            |
| 93 | 
                - }  | 
            |
| 94 | 
                -    func RSADecryptToString(privateKeyPath: String) -> String {
               | 
            |
| 95 | 
                - return String(data: RSADecryptToData(privateKeyPath: privateKeyPath), encoding: String.Encoding.utf8)!  | 
            |
| 96 | 
                - }  | 
            |
| 97 | 
                -}  | 
            |
| 98 | 
                -  | 
            |
| 99 | 
                -extension String {
               | 
            |
| 100 | 
                -  | 
            |
| 101 | 
                -    func RSAEncryptToData(publicKeyPath: String) -> Data {
               | 
            |
| 102 | 
                -  | 
            |
| 103 | 
                - return self.myData.RSAEncryptToData(publicKeyPath: publicKeyPath)  | 
            |
| 104 | 
                - }  | 
            |
| 105 | 
                -  | 
            |
| 106 | 
                -    func RSAEncryptToBase64Data(publicKeyPath: String) -> Data {
               | 
            |
| 107 | 
                - return self.myData.RSAEncryptToBase64Data(publicKeyPath: publicKeyPath)  | 
            |
| 108 | 
                - }  | 
            |
| 109 | 
                -  | 
            |
| 110 | 
                -    func RSAEncryptToBase64String(publicKeyPath: String) -> String {
               | 
            |
| 111 | 
                - return self.myData.RSAEncryptToBase64String(publicKeyPath: publicKeyPath)  | 
            |
| 112 | 
                - }  | 
            |
| 113 | 
                -  | 
            |
| 114 | 
                -    func RSADecryptFromBase64StringToData(privateKeyPath: String) -> Data {
               | 
            |
| 115 | 
                - return (Data(base64Encoded: self)?.RSADecryptToData(privateKeyPath: privateKeyPath))!  | 
            |
| 116 | 
                - }  | 
            |
| 117 | 
                -  | 
            |
| 118 | 
                -    func RSADecryptFromBase64StringToString(privateKeyPath: String) -> String {
               | 
            |
| 119 | 
                - return (Data(base64Encoded: self)?.RSADecryptToString(privateKeyPath: privateKeyPath))!  | 
            |
| 120 | 
                - }  | 
            |
| 121 | 
                -  | 
            |
| 122 | 
                -    func RSADecryptToData(privateKeyPath: String) -> Data {
               | 
            |
| 123 | 
                - return self.myData.RSADecryptToData(privateKeyPath: privateKeyPath)  | 
            |
| 124 | 
                - }  | 
            |
| 125 | 
                -    func RSADecryptToString(privateKeyPath: String) -> String {
               | 
            |
| 126 | 
                - return self.myData.RSADecryptToString(privateKeyPath: privateKeyPath)  | 
            |
| 127 | 
                - }  | 
            |
| 128 | 
                -}  | 
            
                @@ -1,29 +0,0 @@  | 
            ||
| 1 | 
                -//  | 
            |
| 2 | 
                -// String+bytes.swift  | 
            |
| 3 | 
                -// PaiAi  | 
            |
| 4 | 
                -//  | 
            |
| 5 | 
                -// Created by LISA on 2017/6/1.  | 
            |
| 6 | 
                -// Copyright © 2017年 yb. All rights reserved.  | 
            |
| 7 | 
                -//  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -import UIKit  | 
            |
| 10 | 
                -  | 
            |
| 11 | 
                -extension String {
               | 
            |
| 12 | 
                -    public var bytes: UnsafeRawPointer {
               | 
            |
| 13 | 
                - let data = self.data(using: String.Encoding.utf8)!  | 
            |
| 14 | 
                - return (data as NSData).bytes  | 
            |
| 15 | 
                - }  | 
            |
| 16 | 
                -}  | 
            |
| 17 | 
                -  | 
            |
| 18 | 
                -extension String {
               | 
            |
| 19 | 
                -    public var myData: Data {
               | 
            |
| 20 | 
                - return self.data(using: String.Encoding.utf8)!  | 
            |
| 21 | 
                - }  | 
            |
| 22 | 
                -}  | 
            |
| 23 | 
                -  | 
            |
| 24 | 
                -extension String {
               | 
            |
| 25 | 
                -    mutating func appendTimestamp() {
               | 
            |
| 26 | 
                - let timestamp = Int(Date().timeIntervalSince1970)  | 
            |
| 27 | 
                -        self.append("\(timestamp)")
               | 
            |
| 28 | 
                - }  | 
            |
| 29 | 
                -}  | 
            
                @@ -86,7 +86,7 @@ class NavigationBar: UINavigationBar {
               | 
            ||
| 86 | 86 | 
                 | 
            
| 87 | 87 | 
                     func getContentView() -> UIView? {
               | 
            
| 88 | 88 | 
                         for val in subviews {
               | 
            
| 89 | 
                -            if let ContentClass = NSClassFromString("_UINavigationBarContentView"), val.isKind(of: ContentClass) {
               | 
            |
| 89 | 
                +            if let contentClass = NSClassFromString("_UINavigationBarContentView"), val.isKind(of: contentClass) {
               | 
            |
| 90 | 90 | 
                return val  | 
            
| 91 | 91 | 
                }  | 
            
| 92 | 92 | 
                }  | 
            
                @@ -9,34 +9,6 @@  | 
            ||
| 9 | 9 | 
                import UIKit  | 
            
| 10 | 10 | 
                import CoreImage  | 
            
| 11 | 11 | 
                 | 
            
| 12 | 
                -extension NSObject {
               | 
            |
| 13 | 
                -    static func curry<A, B, C, D, E, F>(f:@escaping (A, B, C, D, E) -> F) ->(A)->(B)->(C)->(D)->(E)->F {
               | 
            |
| 14 | 
                -        return {
               | 
            |
| 15 | 
                -            a in {b in {c in {d in {e in f(a, b, c, d, e) }}}}
               | 
            |
| 16 | 
                - }  | 
            |
| 17 | 
                - }  | 
            |
| 18 | 
                -    static func curry<A, B, C, D, E>(f:@escaping (A, B, C, D) -> E) ->(A)->(B)->(C)->(D)->E {
               | 
            |
| 19 | 
                -        return {
               | 
            |
| 20 | 
                -            a in {b in {c in {d in f(a, b, c, d) }}}
               | 
            |
| 21 | 
                - }  | 
            |
| 22 | 
                - }  | 
            |
| 23 | 
                -    static func curry<A, B, C, D>(f:@escaping (A, B, C) -> D) ->(A)->(B)->(C)->D {
               | 
            |
| 24 | 
                -        return {
               | 
            |
| 25 | 
                -            a in {b in {c in f(a, b, c) }}
               | 
            |
| 26 | 
                - }  | 
            |
| 27 | 
                - }  | 
            |
| 28 | 
                -    static func curry<A, B, C>(f:@escaping (A, B) -> C) ->(A)->(B)->C {
               | 
            |
| 29 | 
                -        return {
               | 
            |
| 30 | 
                -            a in {b in f(a, b) }
               | 
            |
| 31 | 
                - }  | 
            |
| 32 | 
                - }  | 
            |
| 33 | 
                -    static func curry<A, B>(f:@escaping (A) -> B) -> (A) -> B {
               | 
            |
| 34 | 
                -        return {
               | 
            |
| 35 | 
                - a in f(a)  | 
            |
| 36 | 
                - }  | 
            |
| 37 | 
                - }  | 
            |
| 38 | 
                -}  | 
            |
| 39 | 
                -  | 
            |
| 40 | 12 | 
                 public extension UIImage {
               | 
            
| 41 | 13 | 
                //init with qr code string  | 
            
| 42 | 14 | 
                 | 
            
                @@ -53,7 +53,7 @@ import CoreImage  | 
            ||
| 53 | 53 | 
                height: bounds.height))  | 
            
| 54 | 54 | 
                         guard let view = qrmaskView else { return }
               | 
            
| 55 | 55 | 
                view.configuration = configuration  | 
            
| 56 | 
                - view.backgroundColor = UIColor(r: 0, g: 0, b: 0, a: 0.2)  | 
            |
| 56 | 
                + view.backgroundColor = UIColor(r: 0, g: 0, b: 0, alpha: 0.2)  | 
            |
| 57 | 57 | 
                addSubview(view)  | 
            
| 58 | 58 | 
                }  | 
            
| 59 | 59 | 
                 | 
            
                @@ -29,7 +29,7 @@ open class SideViewController: UIViewController, PresentViewController {
               | 
            ||
| 29 | 29 | 
                     override open func viewDidLoad() {
               | 
            
| 30 | 30 | 
                super.viewDidLoad()  | 
            
| 31 | 31 | 
                view.isUserInteractionEnabled = true  | 
            
| 32 | 
                - view.backgroundColor = UIColor(gray: 52, a: 0)  | 
            |
| 32 | 
                + view.backgroundColor = UIColor(gray: 52, alpha: 0)  | 
            |
| 33 | 33 | 
                configurationGestures()  | 
            
| 34 | 34 | 
                }  | 
            
| 35 | 35 | 
                 | 
            
                @@ -49,7 +49,7 @@ public final class WaterfallFlowLayout: UICollectionViewLayout {
               | 
            ||
| 49 | 49 | 
                let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath)  | 
            
| 50 | 50 | 
                attributes.frame = CGRect(x: itemX, y: itemY, width: itemWidth, height: itemHeight)  | 
            
| 51 | 51 | 
                 | 
            
| 52 | 
                - setMinColumn(h: itemHeight)  | 
            |
| 52 | 
                + setMinColumn(height: itemHeight)  | 
            |
| 53 | 53 | 
                return attributes  | 
            
| 54 | 54 | 
                }  | 
            
| 55 | 55 | 
                 | 
            
                @@ -112,8 +112,8 @@ public final class WaterfallFlowLayout: UICollectionViewLayout {
               | 
            ||
| 112 | 112 | 
                return itemWidth / itemOriginSize.width * itemOriginSize.height  | 
            
| 113 | 113 | 
                }  | 
            
| 114 | 114 | 
                 | 
            
| 115 | 
                -    fileprivate func setMinColumn(h: CGFloat) {
               | 
            |
| 116 | 
                - minColumnHeight += h  | 
            |
| 115 | 
                +    fileprivate func setMinColumn(height: CGFloat) {
               | 
            |
| 116 | 
                + minColumnHeight += height  | 
            |
| 117 | 117 | 
                columnHeights[minColumn] = minColumnHeight  | 
            
| 118 | 118 | 
                         (minColumn, minColumnHeight) = columnHeights.enumerated().min(by: { $0.1 < $1.1 }) ?? (0, 0)
               | 
            
| 119 | 119 | 
                }  | 
            
                @@ -16,19 +16,16 @@ class GestureRecognizerProxy: NSObject, UIGestureRecognizerDelegate {
               | 
            ||
| 16 | 16 | 
                }  | 
            
| 17 | 17 | 
                 | 
            
| 18 | 18 | 
                     func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
               | 
            
| 19 | 
                -        guard let d = delegate else { return false }
               | 
            |
| 20 | 
                - return d.gestureRecognizerShouldBegin(gestureRecognizer)  | 
            |
| 19 | 
                + return delegate?.gestureRecognizerShouldBegin(gestureRecognizer) ?? false  | 
            |
| 21 | 20 | 
                }  | 
            
| 22 | 21 | 
                 | 
            
| 23 | 22 | 
                     func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
               | 
            
| 24 | 
                -        guard let d = delegate else { return false }
               | 
            |
| 25 | 
                - return d.gestureRecognizer(gestureRecognizer, shouldReceive: touch)  | 
            |
| 23 | 
                + return delegate?.gestureRecognizer(gestureRecognizer, shouldReceive: touch) ?? false  | 
            |
| 26 | 24 | 
                }  | 
            
| 27 | 25 | 
                 | 
            
| 28 | 26 | 
                func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,  | 
            
| 29 | 27 | 
                                            shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
               | 
            
| 30 | 
                -        guard let d = delegate else { return false }
               | 
            |
| 31 | 
                - return d.gestureRecognizer(gestureRecognizer, shouldRecognizeSimultaneouslyWith: otherGestureRecognizer)  | 
            |
| 28 | 
                + return delegate?.gestureRecognizer(gestureRecognizer, shouldRecognizeSimultaneouslyWith: otherGestureRecognizer) ?? false //swiftlint:disable:this line_length  | 
            |
| 32 | 29 | 
                }  | 
            
| 33 | 30 | 
                }  | 
            
| 34 | 31 | 
                 | 
            
                @@ -1,19 +0,0 @@  | 
            ||
| 1 | 
                -//  | 
            |
| 2 | 
                -// NavigationBarDelegate.swift  | 
            |
| 3 | 
                -// PaiaiUIKit  | 
            |
| 4 | 
                -//  | 
            |
| 5 | 
                -// Created by FFIB on 2019/1/30.  | 
            |
| 6 | 
                -// Copyright © 2019 FFIB. All rights reserved.  | 
            |
| 7 | 
                -//  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -import UIKit  | 
            |
| 10 | 
                -  | 
            |
| 11 | 
                -public protocol NavigationBarDelegate: class {
               | 
            |
| 12 | 
                - func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool  | 
            |
| 13 | 
                -}  | 
            |
| 14 | 
                -  | 
            |
| 15 | 
                -public extension NavigationBarDelegate {
               | 
            |
| 16 | 
                -    func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool {
               | 
            |
| 17 | 
                - return true  | 
            |
| 18 | 
                - }  | 
            |
| 19 | 
                -}  | 
            
                @@ -1,41 +0,0 @@  | 
            ||
| 1 | 
                -//  | 
            |
| 2 | 
                -// NavigationBarProxy.swift  | 
            |
| 3 | 
                -// PaiaiUIKit  | 
            |
| 4 | 
                -//  | 
            |
| 5 | 
                -// Created by FFIB on 2019/1/30.  | 
            |
| 6 | 
                -// Copyright © 2019 FFIB. All rights reserved.  | 
            |
| 7 | 
                -//  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -import UIKit  | 
            |
| 10 | 
                -  | 
            |
| 11 | 
                -class NavigationBarProxy: NSObject, UINavigationBarDelegate {
               | 
            |
| 12 | 
                - weak var delegate: NavigationBarDelegate?  | 
            |
| 13 | 
                -  | 
            |
| 14 | 
                -    init(target: NavigationBarDelegate) {
               | 
            |
| 15 | 
                - delegate = target  | 
            |
| 16 | 
                - }  | 
            |
| 17 | 
                -  | 
            |
| 18 | 
                -    func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool {
               | 
            |
| 19 | 
                -        guard let d = delegate else { return true }
               | 
            |
| 20 | 
                - return d.navigationBar(navigationBar, shouldPush: item)  | 
            |
| 21 | 
                - }  | 
            |
| 22 | 
                -}  | 
            |
| 23 | 
                -  | 
            |
| 24 | 
                -extension UINavigationBar {
               | 
            |
| 25 | 
                -    private struct AssociatedKeys {
               | 
            |
| 26 | 
                - static var proxyKey = "NavigationBarProxyKey"  | 
            |
| 27 | 
                - }  | 
            |
| 28 | 
                -  | 
            |
| 29 | 
                -    private var proxy: NavigationBarProxy? {
               | 
            |
| 30 | 
                -        get { return objc_getAssociatedObject(self, &AssociatedKeys.proxyKey) as? NavigationBarProxy }
               | 
            |
| 31 | 
                -        set { objc_setAssociatedObject(self,
               | 
            |
| 32 | 
                - &AssociatedKeys.proxyKey,  | 
            |
| 33 | 
                - newValue,  | 
            |
| 34 | 
                - objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC) }  | 
            |
| 35 | 
                - }  | 
            |
| 36 | 
                -  | 
            |
| 37 | 
                -    func setDelegate<T: NavigationBarDelegate>(_ target: T) {
               | 
            |
| 38 | 
                - proxy = NavigationBarProxy(target: target)  | 
            |
| 39 | 
                - delegate = proxy  | 
            |
| 40 | 
                - }  | 
            |
| 41 | 
                -}  | 
            
                @@ -59,7 +59,7 @@ fileprivate extension GroupDetailViewController {
               | 
            ||
| 59 | 59 | 
                }  | 
            
| 60 | 60 | 
                 | 
            
| 61 | 61 | 
                     func bindViewModelToGroupName() {
               | 
            
| 62 | 
                - viewModel.groupName.bind(to: groupNameLabel.rx.text).disposed(by: disposeBag)  | 
            |
| 62 | 
                + viewModel.group_name.bind(to: groupNameLabel.rx.text).disposed(by: disposeBag)  | 
            |
| 63 | 63 | 
                }  | 
            
| 64 | 64 | 
                 | 
            
| 65 | 65 | 
                     func bindViewModelToGroupMemberCount() {
               | 
            
                @@ -71,7 +71,7 @@ fileprivate extension GroupDetailViewController {
               | 
            ||
| 71 | 71 | 
                }  | 
            
| 72 | 72 | 
                 | 
            
| 73 | 73 | 
                     func bindViewModelToGroupLock() {
               | 
            
| 74 | 
                - viewModel.groupLock.bind(to: groupLockSwitch.rx.value).disposed(by: disposeBag)  | 
            |
| 74 | 
                + viewModel.group_lock.bind(to: groupLockSwitch.rx.value).disposed(by: disposeBag)  | 
            |
| 75 | 75 | 
                }  | 
            
| 76 | 76 | 
                 | 
            
| 77 | 77 | 
                     func bindViewModelToGroupLockSwitch() {
               | 
            
                @@ -102,10 +102,10 @@ extension GroupDetailViewController {
               | 
            ||
| 102 | 102 | 
                 | 
            
| 103 | 103 | 
                     @IBAction func presentGroupQR(_ sender: UITapGestureRecognizer) {
               | 
            
| 104 | 104 | 
                let groupItem = viewModel.item.value.group  | 
            
| 105 | 
                - let alert = AlertViewController(style: .custom(GroupQRView(groupName: groupItem.groupName,  | 
            |
| 106 | 
                - groupAvatar: "Group\(groupItem.groupDefaultAvatar)",  | 
            |
| 107 | 
                - groupQR: "https:pai.ai/g/\(groupItem.group_id)"),  | 
            |
| 108 | 
                - AlertAnimator()) )  | 
            |
| 105 | 
                + let qrView = GroupQRView(group_name: groupItem.group_name,  | 
            |
| 106 | 
                + group_avatar: "Group\(groupItem.group_default_avatar)",  | 
            |
| 107 | 
                + groupQR: "https:pai.ai/g/\(groupItem.group_id)")  | 
            |
| 108 | 
                + let alert = AlertViewController(style: .custom(qrView, AlertAnimator()))  | 
            |
| 109 | 109 | 
                presentController(alert)  | 
            
| 110 | 110 | 
                }  | 
            
| 111 | 111 | 
                 | 
            
                @@ -33,7 +33,7 @@ final class GroupNameModificationViewController: UIViewController {
               | 
            ||
| 33 | 33 | 
                let leftView = UIView(frame: CGRect(x: 0, y: 0, width: 12, height: textField.width))  | 
            
| 34 | 34 | 
                textField.leftView = leftView  | 
            
| 35 | 35 | 
                textField.leftViewMode = .always  | 
            
| 36 | 
                - textField.placeholder = viewModel.item.value.group.groupName  | 
            |
| 36 | 
                + textField.placeholder = viewModel.item.value.group.group_name  | 
            |
| 37 | 37 | 
                }  | 
            
| 38 | 38 | 
                 | 
            
| 39 | 39 | 
                     func bindTextFieldToSaveButton() {
               | 
            
                @@ -11,14 +11,14 @@ import PaiaiUIKit  | 
            ||
| 11 | 11 | 
                 | 
            
| 12 | 12 | 
                 class GroupQRView: NiblessView {
               | 
            
| 13 | 13 | 
                 | 
            
| 14 | 
                - private var groupName: String  | 
            |
| 15 | 
                - private var groupAvatar: String  | 
            |
| 14 | 
                + private var group_name: String  | 
            |
| 15 | 
                + private var group_avatar: String  | 
            |
| 16 | 16 | 
                private var groupQR: String  | 
            
| 17 | 17 | 
                 | 
            
| 18 | 18 | 
                     lazy var groupAvatarImageView: UIImageView = {
               | 
            
| 19 | 19 | 
                let imageView = UIImageView()  | 
            
| 20 | 20 | 
                 | 
            
| 21 | 
                - imageView.image = UIImage(named: groupAvatar)  | 
            |
| 21 | 
                + imageView.image = UIImage(named: group_avatar)  | 
            |
| 22 | 22 | 
                 | 
            
| 23 | 23 | 
                return imageView  | 
            
| 24 | 24 | 
                }()  | 
            
                @@ -26,7 +26,7 @@ class GroupQRView: NiblessView {
               | 
            ||
| 26 | 26 | 
                     lazy var groupNameLabel: UILabel = {
               | 
            
| 27 | 27 | 
                let label = UILabel()  | 
            
| 28 | 28 | 
                 | 
            
| 29 | 
                - label.text = groupName  | 
            |
| 29 | 
                + label.text = group_name  | 
            |
| 30 | 30 | 
                label.font = UIFont.systemFont(ofSize: 17)  | 
            
| 31 | 31 | 
                 | 
            
| 32 | 32 | 
                return label  | 
            
                @@ -50,9 +50,9 @@ class GroupQRView: NiblessView {
               | 
            ||
| 50 | 50 | 
                return label  | 
            
| 51 | 51 | 
                }()  | 
            
| 52 | 52 | 
                 | 
            
| 53 | 
                -    init(groupName: String, groupAvatar: String, groupQR: String) {
               | 
            |
| 54 | 
                - self.groupName = groupName  | 
            |
| 55 | 
                - self.groupAvatar = groupAvatar  | 
            |
| 53 | 
                +    init(group_name: String, group_avatar: String, groupQR: String) {
               | 
            |
| 54 | 
                + self.group_name = group_name  | 
            |
| 55 | 
                + self.group_avatar = group_avatar  | 
            |
| 56 | 56 | 
                self.groupQR = groupQR  | 
            
| 57 | 57 | 
                 | 
            
| 58 | 58 | 
                super.init(frame: CGRect.zero)  | 
            
                @@ -147,11 +147,11 @@ fileprivate extension GroupViewController {
               | 
            ||
| 147 | 147 | 
                }  | 
            
| 148 | 148 | 
                 | 
            
| 149 | 149 | 
                     func bindViewModelToNavigationBarTitle() {
               | 
            
| 150 | 
                - viewModel.groupName.bind(to: navigationBarViewTitle.rx.text).disposed(by: disposeBag)  | 
            |
| 150 | 
                + viewModel.group_name.bind(to: navigationBarViewTitle.rx.text).disposed(by: disposeBag)  | 
            |
| 151 | 151 | 
                }  | 
            
| 152 | 152 | 
                 | 
            
| 153 | 153 | 
                     func bindViewModelToNavigationBarImage() {
               | 
            
| 154 | 
                - viewModel.groupAvatar  | 
            |
| 154 | 
                + viewModel.group_avatar  | 
            |
| 155 | 155 | 
                             .subscribe(onNext: {[weak self] (avatar) in
               | 
            
| 156 | 156 | 
                                 guard let `self` = self else { return }
               | 
            
| 157 | 157 | 
                self.navigationBarViewImage.image = UIImage(named: avatar)  | 
            
                @@ -185,10 +185,10 @@ extension GroupViewController {
               | 
            ||
| 185 | 185 | 
                 | 
            
| 186 | 186 | 
                     @objc func presentGroupQR() {
               | 
            
| 187 | 187 | 
                let groupItem = viewModel.groupItem.value  | 
            
| 188 | 
                - let alert = AlertViewController(style: .custom(GroupQRView(groupName: groupItem.groupName,  | 
            |
| 189 | 
                - groupAvatar: "Group\(groupItem.groupDefaultAvatar)",  | 
            |
| 190 | 
                - groupQR: "https:api.pai.ai/g/\(groupItem.group_id)"),  | 
            |
| 191 | 
                - AlertAnimator()) )  | 
            |
| 188 | 
                + let qrView = GroupQRView(group_name: groupItem.group_name,  | 
            |
| 189 | 
                + group_avatar: "Group\(groupItem.group_default_avatar)",  | 
            |
| 190 | 
                + groupQR: "https:api.pai.ai/g/\(groupItem.group_id)")  | 
            |
| 191 | 
                + let alert = AlertViewController(style: .custom(qrView, AlertAnimator()))  | 
            |
| 192 | 192 | 
                presentController(alert)  | 
            
| 193 | 193 | 
                }  | 
            
| 194 | 194 | 
                }  | 
            
                @@ -71,8 +71,9 @@ extension CreateGroupViewController: UITableViewDataSource, UITableViewDelegate  | 
            ||
| 71 | 71 | 
                default:  | 
            
| 72 | 72 | 
                let cell = tableView.dequeueReusableCell(withIdentifier: "RecentCell", for: indexPath)  | 
            
| 73 | 73 | 
                let group = RecentGroupInfo.share[indexPath.row - 1]  | 
            
| 74 | 
                - cell.textLabel?.text = group.groupName  | 
            |
| 75 | 
                - cell.imageView?.setImage(group.groupAvatar, placeholder: UIImage(named: "Group\(group.groupDefaultAvatar)"))  | 
            |
| 74 | 
                + cell.textLabel?.text = group.group_name  | 
            |
| 75 | 
                + cell.imageView?.setImage(group.group_avatar,  | 
            |
| 76 | 
                + placeholder: UIImage(named: "Group\(group.group_default_avatar)"))  | 
            |
| 76 | 77 | 
                 | 
            
| 77 | 78 | 
                return cell  | 
            
| 78 | 79 | 
                }  | 
            
                @@ -30,10 +30,10 @@ final class MessageCommentAndThumbupCell: UITableViewCell {
               | 
            ||
| 30 | 30 | 
                 | 
            
| 31 | 31 | 
                // MARK: view function  | 
            
| 32 | 32 | 
                     func setInfo(_ info: MessageListItem) {
               | 
            
| 33 | 
                - time.text = info.createAt  | 
            |
| 33 | 
                + time.text = info.create_at  | 
            |
| 34 | 34 | 
                username.text = info.from_nickname  | 
            
| 35 | 35 | 
                userImage.setImage(info.from_avatar, placeholder: UIImage.defaultAvatar)  | 
            
| 36 | 
                - myPhoto.setImage(info.group_photo_info.photoThumbnailUrl, placeholder: UIImage.photoPlaceholder)  | 
            |
| 36 | 
                + myPhoto.setImage(info.group_photo_info.photo_thumbnail_url, placeholder: UIImage.photoPlaceholder)  | 
            |
| 37 | 37 | 
                 | 
            
| 38 | 38 | 
                         if info.msg_title == "评论" {
               | 
            
| 39 | 39 | 
                content.text = info.msg_content  | 
            
                @@ -20,6 +20,6 @@ final class MessageSystemCell: UITableViewCell {
               | 
            ||
| 20 | 20 | 
                     func setInfo(_ info: MessageListItem) {
               | 
            
| 21 | 21 | 
                name.text = info.title  | 
            
| 22 | 22 | 
                content.text = info.content  | 
            
| 23 | 
                - time.text = info.createAt  | 
            |
| 23 | 
                + time.text = info.create_at  | 
            |
| 24 | 24 | 
                }  | 
            
| 25 | 25 | 
                }  | 
            
                @@ -20,9 +20,9 @@ final class GroupCell: UITableViewCell {
               | 
            ||
| 20 | 20 | 
                 | 
            
| 21 | 21 | 
                // MARK: init interface  | 
            
| 22 | 22 | 
                     func setInfo(_ info: GroupItem) {
               | 
            
| 23 | 
                - groupImageView.setImage(info.groupAvatar, placeholder: UIImage(named: "Group\(info.groupDefaultAvatar)"))  | 
            |
| 24 | 
                - groupNameLabel.text = info.groupName  | 
            |
| 25 | 
                - createTimeLabel.text = info.createAt  | 
            |
| 23 | 
                + groupImageView.setImage(info.group_avatar, placeholder: UIImage(named: "Group\(info.group_default_avatar)"))  | 
            |
| 24 | 
                + groupNameLabel.text = info.group_name  | 
            |
| 25 | 
                + createTimeLabel.text = info.create_at  | 
            |
| 26 | 26 | 
                photoNumLabel.text = "有\(info.group_photo_num)张照片"  | 
            
| 27 | 27 | 
                }  | 
            
| 28 | 28 | 
                }  | 
            
                @@ -30,9 +30,9 @@ class PhotoCell: UICollectionViewCell {
               | 
            ||
| 30 | 30 | 
                 | 
            
| 31 | 31 | 
                         switch source {
               | 
            
| 32 | 32 | 
                case .home:  | 
            
| 33 | 
                - headLabel.text = info.groupName  | 
            |
| 34 | 
                - headImageView.setImage(info.groupAvatar, placeholder: UIImage(named: "Group\(info.groupDefaultAvatar)"))  | 
            |
| 35 | 
                - timeLabel.text = info.createAt  | 
            |
| 33 | 
                + headLabel.text = info.group_name  | 
            |
| 34 | 
                + headImageView.setImage(info.group_avatar, placeholder: UIImage(named: "Group\(info.group_default_avatar)"))  | 
            |
| 35 | 
                + timeLabel.text = info.create_at  | 
            |
| 36 | 36 | 
                case .group:  | 
            
| 37 | 37 | 
                headLabel.text = info.nickname  | 
            
| 38 | 38 | 
                headImageView.setImage(info.avatar, placeholder: UIImage.photoPlaceholder)  | 
            
                @@ -40,7 +40,7 @@ class PhotoCell: UICollectionViewCell {
               | 
            ||
| 40 | 40 | 
                }  | 
            
| 41 | 41 | 
                 | 
            
| 42 | 42 | 
                thumbupLabel.text = "\(info.thumbup_num)"  | 
            
| 43 | 
                - commentLabel.text = "\(info.commentNum)"  | 
            |
| 43 | 
                + commentLabel.text = "\(info.comment_num)"  | 
            |
| 44 | 44 | 
                }  | 
            
| 45 | 45 | 
                 | 
            
| 46 | 46 | 
                }  | 
            
                @@ -36,12 +36,12 @@ final class ImageCell: UICollectionViewCell, UIScrollViewDelegate {
               | 
            ||
| 36 | 36 | 
                return photoImage  | 
            
| 37 | 37 | 
                }  | 
            
| 38 | 38 | 
                // MARK: zoom  | 
            
| 39 | 
                -    @objc func doubleTap(_ gr: UITapGestureRecognizer) {
               | 
            |
| 39 | 
                +    @objc func doubleTap(_ gestureRecognizer: UITapGestureRecognizer) {
               | 
            |
| 40 | 40 | 
                         if scrollView.zoomScale > scrollView.minimumZoomScale {
               | 
            
| 41 | 41 | 
                scrollView.setZoomScale(scrollView.minimumZoomScale, animated: true)  | 
            
| 42 | 42 | 
                         } else {
               | 
            
| 43 | 43 | 
                //Zoom to rect  | 
            
| 44 | 
                - let tapPt = gr.location(in: scrollView)  | 
            |
| 44 | 
                + let tapPt = gestureRecognizer.location(in: scrollView)  | 
            |
| 45 | 45 | 
                var zoomRect = CGRect.zero  | 
            
| 46 | 46 | 
                zoomRect.size.width = frame.width / scrollView.maximumZoomScale  | 
            
| 47 | 47 | 
                zoomRect.size.height = frame.height / scrollView.maximumZoomScale  | 
            
                @@ -1,11 +1,7 @@  | 
            ||
| 1 | 1 | 
                <?xml version="1.0" encoding="UTF-8"?>  | 
            
| 2 | 
                -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES">  | 
            |
| 3 | 
                - <device id="retina4_7" orientation="portrait">  | 
            |
| 4 | 
                - <adaptation id="fullscreen"/>  | 
            |
| 5 | 
                - </device>  | 
            |
| 2 | 
                +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES">  | 
            |
| 6 | 3 | 
                <dependencies>  | 
            
| 7 | 
                - <deployment identifier="iOS"/>  | 
            |
| 8 | 
                - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>  | 
            |
| 4 | 
                + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>  | 
            |
| 9 | 5 | 
                <capability name="Safe area layout guides" minToolsVersion="9.0"/>  | 
            
| 10 | 6 | 
                <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>  | 
            
| 11 | 7 | 
                </dependencies>  | 
            
                @@ -156,7 +152,7 @@  | 
            ||
| 156 | 152 | 
                <nil key="highlightedColor"/>  | 
            
| 157 | 153 | 
                </label>  | 
            
| 158 | 154 | 
                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon-time" translatesAutoresizingMaskIntoConstraints="NO" id="xXQ-Hj-wzP">  | 
            
| 159 | 
                - <rect key="frame" x="286" y="0.0" width="36" height="36"/>  | 
            |
| 155 | 
                + <rect key="frame" x="306" y="10" width="16" height="16"/>  | 
            |
| 160 | 156 | 
                </imageView>  | 
            
| 161 | 157 | 
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="5分钟前" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QpI-Mp-URP">  | 
            
| 162 | 158 | 
                <rect key="frame" x="332" y="12" width="37" height="12"/>  | 
            
                @@ -183,24 +179,24 @@  | 
            ||
| 183 | 179 | 
                <rect key="frame" x="0.0" y="444" width="375" height="44"/>  | 
            
| 184 | 180 | 
                <subviews>  | 
            
| 185 | 181 | 
                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon-thumbup" translatesAutoresizingMaskIntoConstraints="NO" id="haH-1L-wfF">  | 
            
| 186 | 
                - <rect key="frame" x="15" y="4" width="36" height="36"/>  | 
            |
| 182 | 
                + <rect key="frame" x="15" y="14" width="16" height="16"/>  | 
            |
| 187 | 183 | 
                </imageView>  | 
            
| 188 | 184 | 
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="赞" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vrx-vV-ymg">  | 
            
| 189 | 
                - <rect key="frame" x="57" y="13.5" width="14.5" height="17"/>  | 
            |
| 185 | 
                + <rect key="frame" x="37" y="13.5" width="14.5" height="17"/>  | 
            |
| 190 | 186 | 
                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>  | 
            
| 191 | 187 | 
                <fontDescription key="fontDescription" type="system" pointSize="14"/>  | 
            
| 192 | 188 | 
                <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>  | 
            
| 193 | 189 | 
                <nil key="highlightedColor"/>  | 
            
| 194 | 190 | 
                </label>  | 
            
| 195 | 191 | 
                <label opaque="NO" userInteractionEnabled="NO" tag="1002" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="(0)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h88-PP-cvG">  | 
            
| 196 | 
                - <rect key="frame" x="77.5" y="14.5" width="17" height="15"/>  | 
            |
| 192 | 
                + <rect key="frame" x="57.5" y="14.5" width="17" height="15"/>  | 
            |
| 197 | 193 | 
                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>  | 
            
| 198 | 194 | 
                <fontDescription key="fontDescription" type="system" pointSize="12"/>  | 
            
| 199 | 195 | 
                <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>  | 
            
| 200 | 196 | 
                <nil key="highlightedColor"/>  | 
            
| 201 | 197 | 
                </label>  | 
            
| 202 | 198 | 
                <imageView userInteractionEnabled="NO" tag="1008" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="list-arrow" translatesAutoresizingMaskIntoConstraints="NO" id="sg5-Nx-u2C">  | 
            
| 203 | 
                - <rect key="frame" x="341" y="4" width="24" height="36"/>  | 
            |
| 199 | 
                + <rect key="frame" x="349" y="14" width="16" height="16"/>  | 
            |
| 204 | 200 | 
                </imageView>  | 
            
| 205 | 201 | 
                </subviews>  | 
            
| 206 | 202 | 
                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>  | 
            
                @@ -227,24 +223,24 @@  | 
            ||
| 227 | 223 | 
                <rect key="frame" x="0.0" y="489" width="375" height="44"/>  | 
            
| 228 | 224 | 
                <subviews>  | 
            
| 229 | 225 | 
                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon-comment" translatesAutoresizingMaskIntoConstraints="NO" id="zTQ-T2-IMt">  | 
            
| 230 | 
                - <rect key="frame" x="15" y="4" width="36" height="36"/>  | 
            |
| 226 | 
                + <rect key="frame" x="15" y="14" width="16" height="16"/>  | 
            |
| 231 | 227 | 
                </imageView>  | 
            
| 232 | 228 | 
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="评论" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vLK-B7-FQc">  | 
            
| 233 | 
                - <rect key="frame" x="57" y="13.5" width="29" height="17"/>  | 
            |
| 229 | 
                + <rect key="frame" x="37" y="13.5" width="29" height="17"/>  | 
            |
| 234 | 230 | 
                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>  | 
            
| 235 | 231 | 
                <fontDescription key="fontDescription" type="system" pointSize="14"/>  | 
            
| 236 | 232 | 
                <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>  | 
            
| 237 | 233 | 
                <nil key="highlightedColor"/>  | 
            
| 238 | 234 | 
                </label>  | 
            
| 239 | 235 | 
                <label opaque="NO" userInteractionEnabled="NO" tag="1002" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="(0)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cuT-s1-NnA">  | 
            
| 240 | 
                - <rect key="frame" x="92" y="14.5" width="17" height="15"/>  | 
            |
| 236 | 
                + <rect key="frame" x="72" y="14.5" width="17" height="15"/>  | 
            |
| 241 | 237 | 
                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>  | 
            
| 242 | 238 | 
                <fontDescription key="fontDescription" type="system" pointSize="12"/>  | 
            
| 243 | 239 | 
                <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>  | 
            
| 244 | 240 | 
                <nil key="highlightedColor"/>  | 
            
| 245 | 241 | 
                </label>  | 
            
| 246 | 242 | 
                <imageView userInteractionEnabled="NO" tag="1009" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="list-arrow" translatesAutoresizingMaskIntoConstraints="NO" id="ns5-B1-ilP">  | 
            
| 247 | 
                - <rect key="frame" x="341" y="4" width="24" height="36"/>  | 
            |
| 243 | 
                + <rect key="frame" x="349" y="14" width="16" height="16"/>  | 
            |
| 248 | 244 | 
                </imageView>  | 
            
| 249 | 245 | 
                </subviews>  | 
            
| 250 | 246 | 
                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>  | 
            
                @@ -527,8 +523,8 @@  | 
            ||
| 527 | 523 | 
                <outlet property="commentTableView" destination="fD2-Ow-gtt" id="jog-WM-p44"/>  | 
            
| 528 | 524 | 
                <outlet property="commentTextField" destination="1va-ae-Juh" id="TpO-kE-PhT"/>  | 
            
| 529 | 525 | 
                <outlet property="enterGroupView" destination="gSr-Cm-y1W" id="bNT-Z4-eOG"/>  | 
            
| 530 | 
                - <outlet property="groupAvatar" destination="nng-M9-7cj" id="Y42-Tc-QnV"/>  | 
            |
| 531 | 
                - <outlet property="groupName" destination="XM7-FX-tOk" id="ifP-h1-72j"/>  | 
            |
| 526 | 
                + <outlet property="group_avatar" destination="nng-M9-7cj" id="Y42-Tc-QnV"/>  | 
            |
| 527 | 
                + <outlet property="group_name" destination="XM7-FX-tOk" id="ifP-h1-72j"/>  | 
            |
| 532 | 528 | 
                <outlet property="keyboardGestureRcognizer" destination="bqM-7G-5Nw" id="uUS-Ox-osk"/>  | 
            
| 533 | 529 | 
                <outlet property="photoCollectionView" destination="dtf-M8-otl" id="VlY-wa-ekc"/>  | 
            
| 534 | 530 | 
                <outlet property="photoTime" destination="QpI-Mp-URP" id="rJM-TG-fZW"/>  | 
            
                @@ -567,14 +563,14 @@  | 
            ||
| 567 | 563 | 
                <objects>  | 
            
| 568 | 564 | 
                <viewController storyboardIdentifier="ShareViewController" automaticallyAdjustsScrollViewInsets="NO" id="KnW-jg-4H5" customClass="ShareViewController" customModule="Paiai_iOS" customModuleProvider="target" sceneMemberID="viewController">  | 
            
| 569 | 565 | 
                <view key="view" contentMode="scaleToFill" id="rN5-Zb-vwm">  | 
            
| 570 | 
                - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>  | 
            |
| 566 | 
                + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>  | 
            |
| 571 | 567 | 
                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>  | 
            
| 572 | 568 | 
                <subviews>  | 
            
| 573 | 569 | 
                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="edT-EA-xhZ" userLabel="Share View">  | 
            
| 574 | 
                - <rect key="frame" x="0.0" y="463" width="375" height="77"/>  | 
            |
| 570 | 
                + <rect key="frame" x="0.0" y="692" width="414" height="77"/>  | 
            |
| 575 | 571 | 
                <subviews>  | 
            
| 576 | 572 | 
                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="itC-HJ-ZaT" userLabel="circle">  | 
            
| 577 | 
                - <rect key="frame" x="30.5" y="0.0" width="54" height="71"/>  | 
            |
| 573 | 
                + <rect key="frame" x="36.5" y="0.0" width="54" height="71"/>  | 
            |
| 578 | 574 | 
                <subviews>  | 
            
| 579 | 575 | 
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yKG-rx-pgX">  | 
            
| 580 | 576 | 
                <rect key="frame" x="0.0" y="0.0" width="54" height="54"/>  | 
            
                @@ -599,7 +595,7 @@  | 
            ||
| 599 | 595 | 
                </constraints>  | 
            
| 600 | 596 | 
                </stackView>  | 
            
| 601 | 597 | 
                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="W6V-MR-s2s" userLabel="weixin">  | 
            
| 602 | 
                - <rect key="frame" x="117" y="0.0" width="54" height="71"/>  | 
            |
| 598 | 
                + <rect key="frame" x="131.5" y="0.0" width="54" height="71"/>  | 
            |
| 603 | 599 | 
                <subviews>  | 
            
| 604 | 600 | 
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WHf-tp-9sX">  | 
            
| 605 | 601 | 
                <rect key="frame" x="0.0" y="0.0" width="54" height="54"/>  | 
            
                @@ -624,7 +620,7 @@  | 
            ||
| 624 | 620 | 
                </constraints>  | 
            
| 625 | 621 | 
                </stackView>  | 
            
| 626 | 622 | 
                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="KU1-aO-nLf" userLabel="QQ">  | 
            
| 627 | 
                - <rect key="frame" x="202" y="0.0" width="54" height="71"/>  | 
            |
| 623 | 
                + <rect key="frame" x="226" y="0.0" width="54" height="71"/>  | 
            |
| 628 | 624 | 
                <subviews>  | 
            
| 629 | 625 | 
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kgp-ou-XXF">  | 
            
| 630 | 626 | 
                <rect key="frame" x="0.0" y="0.0" width="54" height="54"/>  | 
            
                @@ -649,7 +645,7 @@  | 
            ||
| 649 | 645 | 
                </constraints>  | 
            
| 650 | 646 | 
                </stackView>  | 
            
| 651 | 647 | 
                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="ZLk-gf-Jzh" userLabel="weibo">  | 
            
| 652 | 
                - <rect key="frame" x="285.5" y="0.0" width="54" height="71"/>  | 
            |
| 648 | 
                + <rect key="frame" x="318" y="0.0" width="54" height="71"/>  | 
            |
| 653 | 649 | 
                <subviews>  | 
            
| 654 | 650 | 
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uCq-aJ-DOY">  | 
            
| 655 | 651 | 
                <rect key="frame" x="0.0" y="0.0" width="54" height="54"/>  | 
            
                @@ -708,11 +704,11 @@  | 
            ||
| 708 | 704 | 
                <objects>  | 
            
| 709 | 705 | 
                <viewController storyboardIdentifier="PhotoPreviewViewController" automaticallyAdjustsScrollViewInsets="NO" id="p3y-A2-QU1" userLabel="PhotoPreviewViewController" customClass="PhotoPreviewViewController" customModule="Paiai_iOS" customModuleProvider="target" sceneMemberID="viewController">  | 
            
| 710 | 706 | 
                <view key="view" contentMode="scaleToFill" id="MdC-Fu-zFL">  | 
            
| 711 | 
                - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>  | 
            |
| 707 | 
                + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>  | 
            |
| 712 | 708 | 
                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>  | 
            
| 713 | 709 | 
                <subviews>  | 
            
| 714 | 710 | 
                <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" pagingEnabled="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" indicatorStyle="white" dataMode="prototypes" prefetchingEnabled="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cvI-jg-TrD">  | 
            
| 715 | 
                - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>  | 
            |
| 711 | 
                + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>  | 
            |
| 716 | 712 | 
                <collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="nE7-Ce-1KB">  | 
            
| 717 | 713 | 
                <size key="itemSize" width="237.5" height="357"/>  | 
            
| 718 | 714 | 
                <size key="headerReferenceSize" width="0.0" height="0.0"/>  | 
            
                @@ -721,7 +717,7 @@  | 
            ||
| 721 | 717 | 
                </collectionViewFlowLayout>  | 
            
| 722 | 718 | 
                <cells>  | 
            
| 723 | 719 | 
                <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="imageCell" id="PAU-eQ-c9k" customClass="ImageCell" customModule="Paiai_iOS" customModuleProvider="target">  | 
            
| 724 | 
                - <rect key="frame" x="0.0" y="155" width="237.5" height="357"/>  | 
            |
| 720 | 
                + <rect key="frame" x="0.0" y="0.0" width="237.5" height="357"/>  | 
            |
| 725 | 721 | 
                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>  | 
            
| 726 | 722 | 
                <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">  | 
            
| 727 | 723 | 
                <rect key="frame" x="0.0" y="0.0" width="237.5" height="357"/>  | 
            
                @@ -749,24 +745,24 @@  | 
            ||
| 749 | 745 | 
                </cells>  | 
            
| 750 | 746 | 
                </collectionView>  | 
            
| 751 | 747 | 
                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BRP-J0-WGF" userLabel="button group">  | 
            
| 752 | 
                - <rect key="frame" x="0.0" y="623" width="375" height="44"/>  | 
            |
| 748 | 
                + <rect key="frame" x="0.0" y="852" width="414" height="44"/>  | 
            |
| 753 | 749 | 
                <subviews>  | 
            
| 754 | 750 | 
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2r6-s1-9be" userLabel="back">  | 
            
| 755 | 
                - <rect key="frame" x="43.5" y="-26" width="96" height="96"/>  | 
            |
| 751 | 
                + <rect key="frame" x="93" y="11" width="16" height="22"/>  | 
            |
| 756 | 752 | 
                <state key="normal" image="navigation-back"/>  | 
            
| 757 | 753 | 
                <connections>  | 
            
| 758 | 754 | 
                <action selector="back" destination="p3y-A2-QU1" eventType="touchUpInside" id="xKk-c3-Iub"/>  | 
            
| 759 | 755 | 
                </connections>  | 
            
| 760 | 756 | 
                </button>  | 
            
| 761 | 757 | 
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aOC-mu-785" userLabel="rotate">  | 
            
| 762 | 
                - <rect key="frame" x="139.5" y="-26" width="96" height="96"/>  | 
            |
| 758 | 
                + <rect key="frame" x="199" y="11" width="16" height="22"/>  | 
            |
| 763 | 759 | 
                <state key="normal" image="BTN-rotate"/>  | 
            
| 764 | 760 | 
                <connections>  | 
            
| 765 | 761 | 
                <action selector="rotateTheImage:" destination="p3y-A2-QU1" eventType="touchUpInside" id="LiB-TG-UYL"/>  | 
            
| 766 | 762 | 
                </connections>  | 
            
| 767 | 763 | 
                </button>  | 
            
| 768 | 764 | 
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Q90-2h-mGx" userLabel="download">  | 
            
| 769 | 
                - <rect key="frame" x="231" y="-26" width="96" height="96"/>  | 
            |
| 765 | 
                + <rect key="frame" x="300" y="11" width="16" height="22"/>  | 
            |
| 770 | 766 | 
                <state key="normal" image="BTN-download"/>  | 
            
| 771 | 767 | 
                <connections>  | 
            
| 772 | 768 | 
                <action selector="download:" destination="p3y-A2-QU1" eventType="touchUpInside" id="cEE-Yt-FWf"/>  | 
            
                @@ -32,6 +32,6 @@ class PhotoDetailCommentCell: UITableViewCell {
               | 
            ||
| 32 | 32 | 
                headImage.setImage(info.avatar, placeholder: UIImage.defaultAvatar)  | 
            
| 33 | 33 | 
                name.text = info.nickname  | 
            
| 34 | 34 | 
                content.text = info.comment  | 
            
| 35 | 
                - time.text = info.createAt  | 
            |
| 35 | 
                + time.text = info.create_at  | 
            |
| 36 | 36 | 
                }  | 
            
| 37 | 37 | 
                }  | 
            
                @@ -16,8 +16,8 @@ import PaiaiUIKit  | 
            ||
| 16 | 16 | 
                 final class PhotoDetailViewController: UIViewController {
               | 
            
| 17 | 17 | 
                 | 
            
| 18 | 18 | 
                @IBOutlet weak var enterGroupView: UIView!  | 
            
| 19 | 
                - @IBOutlet weak var groupAvatar: UIImageView!  | 
            |
| 20 | 
                - @IBOutlet weak var groupName: UILabel!  | 
            |
| 19 | 
                + @IBOutlet weak var group_avatar: UIImageView!  | 
            |
| 20 | 
                + @IBOutlet weak var group_name: UILabel!  | 
            |
| 21 | 21 | 
                 | 
            
| 22 | 22 | 
                @IBOutlet weak var photoCollectionView: UICollectionView!  | 
            
| 23 | 23 | 
                 | 
            
                @@ -99,7 +99,7 @@ extension PhotoDetailViewController {
               | 
            ||
| 99 | 99 | 
                     @IBAction func share() {
               | 
            
| 100 | 100 | 
                // let ctl = ShareViewController UIStoryboard.photoDetail.instantiateController(ShareViewController.self)  | 
            
| 101 | 101 | 
                // ctl.shareContent = "我使用拍爱分享了一张美图,你也快来试试吧"  | 
            
| 102 | 
                -// // ctl.shareImgUrlThumb = datas[currentPhotoIndex].photoThumbnailUrl  | 
            |
| 102 | 
                +// // ctl.shareImgUrlThumb = datas[currentPhotoIndex].photo_thumbnail_url  | 
            |
| 103 | 103 | 
                // // ctl.shareUrl = datas[currentPhotoIndex].photo_share_url  | 
            
| 104 | 104 | 
                // presentController(ctl)  | 
            
| 105 | 105 | 
                }  | 
            
                @@ -139,7 +139,7 @@ extension PhotoDetailViewController {
               | 
            ||
| 139 | 139 | 
                             configureCell: {(_, collectionView, indexPath, item) in
               | 
            
| 140 | 140 | 
                let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "photoDetailImageCell",  | 
            
| 141 | 141 | 
                for: indexPath) as! PhotoDetailImageCell  | 
            
| 142 | 
                - cell.imageView.setImage(item.murl.isEmpty ? item.photoThumbnail2Url : item.murl,  | 
            |
| 142 | 
                + cell.imageView.setImage(item.murl.isEmpty ? item.photo_thumbnail2_url : item.murl,  | 
            |
| 143 | 143 | 
                placeholder: UIImage.photoPlaceholder)  | 
            
| 144 | 144 | 
                return cell  | 
            
| 145 | 145 | 
                })  | 
            
                @@ -185,13 +185,13 @@ extension PhotoDetailViewController {
               | 
            ||
| 185 | 185 | 
                }  | 
            
| 186 | 186 | 
                 | 
            
| 187 | 187 | 
                     func bindViewModelToGroupName() {
               | 
            
| 188 | 
                - viewModel.groupName.bind(to: groupName.rx.text).disposed(by: disposeBag)  | 
            |
| 188 | 
                + viewModel.group_name.bind(to: group_name.rx.text).disposed(by: disposeBag)  | 
            |
| 189 | 189 | 
                }  | 
            
| 190 | 190 | 
                 | 
            
| 191 | 191 | 
                     func bindViewModelToGroupAvatar() {
               | 
            
| 192 | 
                - viewModel.groupAvatar  | 
            |
| 192 | 
                + viewModel.group_avatar  | 
            |
| 193 | 193 | 
                             .map { UIImage(named: #"Group\#($0)"#)}
               | 
            
| 194 | 
                - .bind(to: groupAvatar.rx.image)  | 
            |
| 194 | 
                + .bind(to: group_avatar.rx.image)  | 
            |
| 195 | 195 | 
                .disposed(by: disposeBag)  | 
            
| 196 | 196 | 
                }  | 
            
| 197 | 197 | 
                 |