10 ol-10"> 15
+    public var created_at: Date?
16
+    public var group_desc: String = ""
17
+    public var group_lock: Bool = false
18
+    public var group_default_avatar = 0
19 19
     public var admin_id = ""
20
-    public var groupName = ""
20
+    public var group_name = ""
21 21
     public var group_from = 0
22 22
     public var group_id = ""
23
-    public var groupAvatar = ""
23
+    public var group_avatar = ""
24 24
     public var group_photo_num = 0
25 25
 
26 26
     //tour group info
@@ -49,16 +49,16 @@ extension GroupItem: Mappable {
49 49
     mutating public func mapping(map: Map) {
50 50
         let dateFormatter = DateFormatter()
51 51
         dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
52
-        createAt            <- map["created_at"]
53
-        createdAt           <-  (map["created_at"], DateFormatterTransform(dateFormatter: dateFormatter))
54
-        groupDesc           <-  map["group_desc"]
55
-        groupLock           <-  map["group_lock"]
56
-        groupDefaultAvatar <-  map["group_default_avatar"]
52
+        create_at            <- map["created_at"]
53
+        created_at           <-  (map["created_at"], DateFormatterTransform(dateFormatter: dateFormatter))
54
+        group_desc           <-  map["group_desc"]
55
+        group_lock           <-  map["group_lock"]
56
+        group_default_avatar <-  map["group_default_avatar"]
57 57
         admin_id             <-  map["admin_id"]
58
-        groupName           <-  map["group_name"]
58
+        group_name           <-  map["group_name"]
59 59
         group_from           <-  map["group_from"]
60 60
         group_id             <-  map["group_id"]
61
-        groupAvatar         <-  map["group_avatar"]
61
+        group_avatar         <-  map["group_avatar"]
62 62
         group_photo_num      <-  map["group_photo_num"]
63 63
         gather_at            <-  (map["gathered_at"], DateFormatterTransform(dateFormatter: dateFormatter))
64 64
         gathered_at          <-  map["gathered_at"]
@@ -75,10 +75,10 @@ extension GroupItem: Mappable {
75 75
             schedules            <-  banner["schedules"]
76 76
         }
77 77
 
78
-        if let date = createdAt {
78
+        if let date = created_at {
79 79
             let createDateFormatter = DateFormatter()
80 80
             createDateFormatter.dateFormat = "yyyy年MM月dd日 HH:mm"
81
-            createAt = createDateFormatter.string(from: date)
81
+            create_at = createDateFormatter.string(from: date)
82 82
         }
83 83
     }
84 84
 }

+ 5 - 5
PaiAi/PaiaiDataKit/DataLayer/Model/MessageListItem.swift

@@ -13,7 +13,7 @@ import RxDataSources
13 13
 public struct MessageListItem: JSONCode {
14 14
     public var content = ""
15 15
     public var msg_title: String = ""
16
-    public var createAt: String = ""
16
+    public var create_at: String = ""
17 17
     public var from_avatar: String = ""
18 18
     public var msg_content: String = ""
19 19
     public var from_nickname: String = ""
@@ -22,7 +22,7 @@ public struct MessageListItem: JSONCode {
22 22
     public var url: String = ""
23 23
 
24 24
     var read: Bool = false
25
-    public var createdAt: Date?
25
+    public var created_at: Date?
26 26
 
27 27
     var pk = 0
28 28
     var from_uid: String = ""
@@ -42,7 +42,7 @@ extension MessageListItem: Mappable {
42 42
     mutating public func mapping(map: Map) {
43 43
         let dateFormatter = DateFormatter()
44 44
         dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
45
-        createdAt          <-  (map["created_at"], DateFormatterTransform(dateFormatter: dateFormatter))
45
+        created_at          <-  (map["created_at"], DateFormatterTransform(dateFormatter: dateFormatter))
46 46
         content             <-  map["content"]
47 47
         pk                  <-  map["pk"]
48 48
         read                <-  map["read"]
@@ -57,8 +57,8 @@ extension MessageListItem: Mappable {
57 57
         url                 <-  map["url"]
58 58
         title               <-  map["title"]
59 59
 
60
-        guard let createdAt = createdAt else { return }
61
-        createAt = createdAt.getTimeInfoFromDate()
60
+        guard let created_at = created_at else { return }
61
+        create_at = created_at.getTimeInfoFromDate()
62 62
     }
63 63
 }
64 64
 

+ 5 - 5
PaiAi/PaiaiDataKit/DataLayer/Model/OrderItem.swift

@@ -17,7 +17,7 @@ public struct OrderItem: JSONCode {
17 17
     public var displayPhoto: String = ""
18 18
     public var displayCreated: String = ""
19 19
 
20
-    var createdAt: Date?
20
+    var created_at: Date?
21 21
     var body: String = ""
22 22
     var to_uid: String = ""
23 23
     var to_lid: String = ""
@@ -50,14 +50,14 @@ extension OrderItem: Mappable {
50 50
         total_fee           <-  map["total_fee"]
51 51
         pay_status          <-  map["pay_status"]
52 52
         group_photo_info    <-  map["group_photo_info"]
53
-        createdAt          <-  (map["created_at"], DateFormatterTransform(dateFormatter: dateFormatter))
53
+        created_at          <-  (map["created_at"], DateFormatterTransform(dateFormatter: dateFormatter))
54 54
 
55 55
         //model display layer
56 56
         order_id            <-  map["order_id"]
57 57
         displayPrice = "+\(total_fee / 100)"
58
-        guard let createdAt = createdAt, let photoInfo = group_photo_info else { return }
59
-        displayCreated = createdAt.getTimeString(format: "YYYY-MM-dd HH:MM")
60
-        displayPhoto = photoInfo.photoThumbnailUrl
58
+        guard let created_at = created_at, let photoInfo = group_photo_info else { return }
59
+        displayCreated = created_at.getTimeString(format: "YYYY-MM-dd HH:MM")
60
+        displayPhoto = photoInfo.photo_thumbnail_url
61 61
     }
62 62
 }
63 63
 

+ 5 - 5
PaiAi/PaiaiDataKit/DataLayer/Model/PhotoCommentItem.swift

@@ -16,8 +16,8 @@ public struct PhotoCommentItem: JSONCode {
16 16
     public var comment: String = ""
17 17
     public var user_id: String = ""
18 18
     public var nickname: String = ""
19
-    public var createdAt: Date?
20
-    public var createAt: String = ""
19
+    public var created_at: Date?
20
+    public var create_at: String = ""
21 21
 
22 22
     init(json: [String: AnyObject]) {
23 23
         self.init(map: Map(mappingType: .fromJSON, JSON: json))
@@ -27,15 +27,15 @@ extension PhotoCommentItem: Mappable {
27 27
     mutating public func mapping(map: Map) {
28 28
         let dateFormatter = DateFormatter()
29 29
         dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
30
-        createdAt      <-  (map["created_t"], DateFormatterTransform(dateFormatter: dateFormatter))
30
+        created_at      <-  (map["created_t"], DateFormatterTransform(dateFormatter: dateFormatter))
31 31
         avatar          <-  (map["avatar"])
32 32
         comment         <-  map["comment"]
33 33
         user_id         <-  map["user_id"]
34 34
         nickname        <-  (map["nickname"])
35 35
         comment         <-  map["comment"]
36 36
 
37
-        if let date = createdAt {
38
-            createAt = date.getTimeInfoFromDate()
37
+        if let date = created_at {
38
+            create_at = date.getTimeInfoFromDate()
39 39
         }
40 40
     }
41 41
 

+ 17 - 17
PaiAi/PaiaiDataKit/DataLayer/Model/PhotoItem.swift

@@ -28,15 +28,15 @@ public struct PhotoItem: JSONCode {
28 28
     public var avatar = ""
29 29
     public var nickname = ""
30 30
 
31
-    public var commentNum = 0
31
+    public var comment_num = 0
32 32
     public var thumbup_num = 0
33 33
 
34
-    public var groupAvatar = ""
35
-    public var groupDefaultAvatar = 0
36
-    public var groupName = ""
34
+    public var group_avatar = ""
35
+    public var group_default_avatar = 0
36
+    public var group_name = ""
37 37
 
38
-    public var photoThumbnailUrl = ""
39
-    public var photoThumbnail2Url = ""
38
+    public var photo_thumbnail_url = ""
39
+    public var photo_thumbnail2_url = ""
40 40
     public var photo_url = ""
41 41
     public var photo_share_url = ""
42 42
     public var thumbup = false
@@ -44,7 +44,7 @@ public struct PhotoItem: JSONCode {
44 44
     public var rurl = ""
45 45
     public var nomark = 0
46 46
 
47
-    public var createAt = ""
47
+    public var create_at = ""
48 48
     public var create_at_time_interval = ""
49 49
 
50 50
     public var user_id = ""
@@ -56,7 +56,7 @@ public struct PhotoItem: JSONCode {
56 56
     public var sizeCache = CGSize(width: 0, height: 0)
57 57
     public var display_payment_btn = 0
58 58
 
59
-    var createdAt: Date?
59
+    var created_at: Date?
60 60
 
61 61
     var photo_thumbnail2_w = 0
62 62
     var photo_thumbnail2_h = 0
@@ -89,24 +89,24 @@ extension PhotoItem: Mappable {
89 89
     mutating public func mapping(map: Map) {
90 90
         let dateFormatter = DateFormatter()
91 91
         dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
92
-        createdAt              <-  (map["created_at"], DateFormatterTransform(dateFormatter: dateFormatter))
92
+        created_at              <-  (map["created_at"], DateFormatterTransform(dateFormatter: dateFormatter))
93 93
         avatar                  <-  map["avatar"]
94
-        commentNum             <-  map["comment_num"]
95
-        groupAvatar            <-  map["group_avatar"]
96
-        groupDefaultAvatar    <-  map["group_default_avatar"]
94
+        comment_num             <-  map["comment_num"]
95
+        group_avatar            <-  map["group_avatar"]
96
+        group_default_avatar    <-  map["group_default_avatar"]
97 97
         group_from              <-  map["group_from"]
98 98
         group_id                <-  map["group_id"]
99
-        groupName              <-  map["group_name"]
99
+        group_name              <-  map["group_name"]
100 100
         nickname                <-  map["nickname"]
101 101
         photoFrom              <-  map["photoFrom"]
102 102
         photo_h                 <-  map["photo_h"]
103 103
         photo_w                 <-  map["photo_w"]
104 104
         photo_id                <-  map["photo_id"]
105 105
         photo_thumbnail2_h      <-  map["photo_thumbnail2_h"]
106
-        photoThumbnail2Url    <-  map["photo_thumbnail2_url"]
106
+        photo_thumbnail2_url    <-  map["photo_thumbnail2_url"]
107 107
         photo_thumbnail2_w      <-  map["photo_thumbnail2_w"]
108 108
         photo_thumbnail_h       <-  map["photo_thumbnail_h"]
109
-        photoThumbnailUrl     <-  map["photo_thumbnail_url"]
109
+        photo_thumbnail_url     <-  map["photo_thumbnail_url"]
110 110
         photo_thumbnail_w       <-  map["photo_thumbnail_w"]
111 111
         photo_url               <-  map["photo_url"]
112 112
         photo_share_url         <-  map["photo_share_url"]
@@ -119,10 +119,10 @@ extension PhotoItem: Mappable {
119 119
         rurl = porder["r_photo_url"] ?? ""
120 120
         murl = porder["m_photo_url"] ?? ""
121 121
 
122
-        guard let date = createdAt else { return }
122
+        guard let date = created_at else { return }
123 123
         let createDateFormatter = DateFormatter()
124 124
         createDateFormatter.dateFormat = "yyyy年MM月dd日"
125
-        createAt = createDateFormatter.string(from: date)
125
+        create_at = createDateFormatter.string(from: date)
126 126
         create_at_time_interval = date.getTimeInfoFromDate()
127 127
     }
128 128
 }

+ 1 - 1
PaiAi/PaiaiDataKit/DataLayer/Repositories/GroupRepository.swift

@@ -13,5 +13,5 @@ protocol GroupRepository {
13 13
     func load(page: Int) -> Single<NetworkArrayData<GroupItem>>
14 14
     func remove(groupId: String) -> Completable
15 15
     func join(type: QRType, parameter: Parameter) -> Single<GroupItem>
16
-    func create(groupName: String, avatar: String)  -> Single<GroupItem>
16
+    func create(group_name: String, avatar: String)  -> Single<GroupItem>
17 17
 }

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Implementation/PhotoGroupRepository.swift

@@ -26,7 +26,7 @@ struct PhotoGroupRepository: GroupRepository {
26 26
         return groupRemoteAPI.remove(groupId: groupId)
27 27
     }
28 28
 
29
-    func create(groupName: String, avatar: String) -> Single<GroupItem> {
30
-        return groupRemoteAPI.create(groupName: groupName, avatar: avatar)
29
+    func create(group_name: String, avatar: String) -> Single<GroupItem> {
30
+        return groupRemoteAPI.create(group_name: group_name, avatar: avatar)
31 31
     }
32 32
 }

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/GroupDetailRemoteAPI.swift

@@ -35,7 +35,7 @@ struct GroupDetailRemoteAPI {
35 35
     }
36 36
 
37 37
     func lock() -> Completable {
38
-        let lockResource = StatusResource(path: .groupLock,
38
+        let lockResource = StatusResource(path: .group_lock,
39 39
                                           parameter: ["user_id": ShareUserId, "group_id": groupId])
40 40
         return lockResource.getStatus()
41 41
     }
@@ -58,7 +58,7 @@ struct GroupDetailRemoteAPI {
58 58
         let updateResource = StatusResource(path: .groupUpdate,
59 59
                                             parameter: ["admin_id": ShareUserId,
60 60
                                                         "group_id": groupId,
61
-                                                        "groupName": name])
61
+                                                        "group_name": name])
62 62
         return updateResource.getStatus()
63 63
     }
64 64
 }

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/GroupRemoteAPI.swift

@@ -39,10 +39,10 @@ struct GroupRemoteAPI {
39 39
         return resource.loadContent()
40 40
     }
41 41
 
42
-    func create(groupName: String, avatar: String) -> Single<GroupItem> {
42
+    func create(group_name: String, avatar: String) -> Single<GroupItem> {
43 43
         let createResource = ContentResource<GroupItem>(path: .groupCreate,
44 44
                                                         parameter: ["user_id": ShareUserId,
45
-                                                                    "groupName": groupName,
45
+                                                                    "group_name": group_name,
46 46
                                                                     "group_default_avatar": avatar],
47 47
                                                         parseJSON: parseGroup)
48 48
         return createResource.loadContent()

+ 1 - 1
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/Reusable/NetWork/Interfaces.swift

@@ -36,7 +36,7 @@ public enum Interfaces: String {
36 36
     //群详情
37 37
     case groupDetail = "/g/detail"
38 38
     case groupUpdate = "/g/update"
39
-    case groupLock = "/g/lock"
39
+    case group_lock = "/g/lock"
40 40
     case groupUnlock = "/g/unlock"
41 41
     case groupQuit = "/g/quit"
42 42
 

+ 7 - 7
PaiAi/PaiaiDataKit/PresentLayer/Group/GroupDetail/GroupDetailViewModel.swift

@@ -27,9 +27,9 @@ public class GroupDetailViewModel {
27 27
     public let didQuit = PublishSubject<Void>()
28 28
     public let item: BehaviorRelay<GroupDetailItem>
29 29
 
30
-    public var groupName: Observable<String> {
30
+    public var group_name: Observable<String> {
31 31
         return item.asObservable().flatMapLatest({ (item) -> Observable<String> in
32
-            return Observable.just(item.group.groupName)
32
+            return Observable.just(item.group.group_name)
33 33
         })
34 34
     }
35 35
 
@@ -51,9 +51,9 @@ public class GroupDetailViewModel {
51 51
         })
52 52
     }
53 53
 
54
-    public var groupLock: Observable<Bool> {
54
+    public var group_lock: Observable<Bool> {
55 55
         return item.asObservable().flatMapLatest({ (item) -> Observable<Bool> in
56
-            return Observable.just(item.group.groupLock)
56
+            return Observable.just(item.group.group_lock)
57 57
         })
58 58
     }
59 59
 
@@ -69,14 +69,14 @@ public class GroupDetailViewModel {
69 69
         if isLock {
70 70
             repository.lock().subscribe(onCompleted: {
71 71
                 var val = self.item.value
72
-                val.group.groupLock = true
72
+                val.group.group_lock = true
73 73
                 self.item.accept(val)
74 74
                 Toast.show(message: "群已锁定")
75 75
             }).disposed(by: disposeBag)
76 76
         } else {
77 77
             repository.unlock().subscribe(onCompleted: {
78 78
                 var val = self.item.value
79
-                val.group.groupLock = false
79
+                val.group.group_lock = false
80 80
                 Toast.show(message: "群未锁定")
81 81
             }).disposed(by: disposeBag)
82 82
         }
@@ -112,7 +112,7 @@ public class GroupDetailViewModel {
112 112
             .subscribe(onCompleted: {[unowned self] in
113 113
                 Toast.show(message: "群名称已修改")
114 114
                 var val = self.item.value
115
-                val.group.groupName = name
115
+                val.group.group_name = name
116 116
                 self.item.accept(val)
117 117
 
118 118
                 let userInfo = [GroupItemsOperator.key: GroupItemsOperator.update(val.group_id, val.group)]

+ 5 - 5
PaiAi/PaiaiDataKit/PresentLayer/Group/GroupViewModel.swift

@@ -28,15 +28,15 @@ public class GroupViewModel {
28 28
 
29 29
     public var groupItem: BehaviorRelay<GroupItem>
30 30
 
31
-    public var groupName: Observable<String> {
31
+    public var group_name: Observable<String> {
32 32
         return groupItem.asObservable().flatMapLatest({ (item) -> Observable<String> in
33
-            return Observable.just(item.groupName)
33
+            return Observable.just(item.group_name)
34 34
         })
35 35
     }
36 36
 
37
-    public var groupAvatar: Observable<String> {
37
+    public var group_avatar: Observable<String> {
38 38
         return groupItem.asObservable().flatMapLatest({ (item) -> Observable<String> in
39
-            return Observable.just("Group\(item.groupDefaultAvatar)")
39
+            return Observable.just("Group\(item.group_default_avatar)")
40 40
         })
41 41
     }
42 42
 
@@ -116,7 +116,7 @@ public class GroupViewModel {
116 116
             var items = self._items.value
117 117
             items = items.map({ item in
118 118
                 var tmp = item
119
-                tmp.groupName = val.groupName
119
+                tmp.group_name = val.group_name
120 120
                 return tmp
121 121
             })
122 122
             self._items.accept(items)

+ 1 - 1
PaiAi/PaiaiDataKit/PresentLayer/Home/CreateGroupViewModel.swift

@@ -40,7 +40,7 @@ public final class CreateGroupViewModel {
40 40
 
41 41
     public func createGroup() {
42 42
         Toast.showActivity(message: "正在创建群")
43
-        return repository.create(groupName: name, avatar: "\(mappingIndex)")
43
+        return repository.create(group_name: name, avatar: "\(mappingIndex)")
44 44
             .subscribe(onSuccess: {[unowned self] item in
45 45
                 Toast.show(message: "照片分享群已创建")
46 46
                 self.delegate?.navigateToGroup(item)

+ 1 - 1
PaiAi/PaiaiDataKit/PresentLayer/Home/HomeViewModel.swift

@@ -112,7 +112,7 @@ public class HomeViewModel {
112 112
 
113 113
                     if item.group_id == groupId {
114 114
                         var tmp = item
115
-                        tmp.groupName = val.groupName
115
+                        tmp.group_name = val.group_name
116 116
 
117 117
                         return tmp
118 118
                     }

+ 1 - 1
PaiAi/PaiaiDataKit/PresentLayer/PhotoDetail/PhotoDetailItemViewModel.swift

@@ -29,7 +29,7 @@ public final class PhotoDetailItemViewModel {
29 29
             self.repository = PhotoDetailRepository(photoId: photoItem.photo_id, groupId: photoItem.group_id)
30 30
             self.loadCommentItems().concat(self.loadThumbupUserItems()).subscribe(onCompleted: {
31 31
                 var val = self.item.value
32
-                val.commentNum = self.commentItems.value.count
32
+                val.comment_num = self.commentItems.value.count
33 33
                 val.thumbup_num = self.thumbupItems.value.count
34 34
                 self.item.accept(val)
35 35
 

+ 4 - 4
PaiAi/PaiaiDataKit/PresentLayer/PhotoDetail/PhotoDetailViewModel.swift

@@ -36,15 +36,15 @@ public final class PhotoDetailViewModel {
36 36
         })
37 37
     }
38 38
 
39
-    public var groupName: Observable<String> {
39
+    public var group_name: Observable<String> {
40 40
         return itemViewModel.item.map({ val in
41
-            return val.groupName
41
+            return val.group_name
42 42
         })
43 43
     }
44 44
 
45
-    public var groupAvatar: Observable<Int> {
45
+    public var group_avatar: Observable<Int> {
46 46
         return itemViewModel.item.map({ val in
47
-            return val.groupDefaultAvatar
47
+            return val.group_default_avatar
48 48
         })
49 49
     }
50 50
 

+ 0 - 58
PaiAi/PaiaiUIKit/Reusable/Extension/CoreGraphics/CLLocationExt.swift

@@ -1,58 +0,0 @@
1
-//
2
-//  CLLocationExt.swift
3
-//  PaiaiUIKit
4
-//
5
-//  Created by FFIB on 2017/9/24.
6
-//  Copyright © 2017年 FFIB. All rights reserved.
7
-//
8
-
9
-import UIKit
10
-import CoreLocation
11
-let a = 6378245.0
12
-let ee = 0.00669342162296594323
13
-//the world coordinate transformation to mars
14
-extension CLLocation {
15
-    public func transformationWorldCoordinateToMars() -> CLLocationCoordinate2D {
16
-        let lat = coordinate.latitude
17
-        let lon = coordinate.longitude
18
-        if outOfChina() {
19
-            return coordinate
20
-        }
21
-        var dLat = transformLatWithX(x: lon - 105.0, y: lat - 35.0)
22
-        var dLon = transformLonWithY(x: lon - 105.0, y: lat - 35.0)
23
-        let radLat = lat / 180.0 * .pi
24
-        var magic = sin(radLat)
25
-        magic = 1 - ee * magic * magic
26
-        let sqrtMagic = sqrt(magic)
27
-        dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * .pi)
28
-        dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * .pi)
29
-        return CLLocationCoordinate2DMake(dLat + coordinate.latitude, dLon + coordinate.longitude)
30
-    }
31
-
32
-    //judge china
33
-    public func outOfChina() -> Bool {
34
-        guard case 72.005..<137.8347 = coordinate.longitude else {
35
-            return true
36
-        }
37
-        guard case 0.8293..<55.8271 = coordinate.latitude else {
38
-            return true
39
-        }
40
-        return false
41
-    }
42
-
43
-    public func transformLatWithX(x: Double, y: Double) -> Double {
44
-        var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 *  sqrt(abs(x))
45
-        ret += (20.0 * sin(6.0 * x * .pi) + 20.0 * sin(2.0 * x * .pi)) * 2.0 / 3.0
46
-        ret += (20.0 * sin(y * .pi) + 40.0 * sin(y / 3.0 * .pi)) * 2.0 / 3.0
47
-        ret += (160.0 * sin(y / 12.0 * .pi) + 320.0 * sin(y * .pi / 30.0)) * 2.0 / 3.0
48
-        return ret
49
-    }
50
-
51
-    public func transformLonWithY(x: Double, y: Double) -> Double {
52
-        var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * sqrt(abs(x))
53
-        ret += (20.0 * sin(6.0 * x * .pi) + 20.0 * sin(2.0 * x * .pi)) * 2.0 / 3.0
54
-        ret += (20.0 * sin(x * .pi) + 40.0 * sin(x / 3.0 * .pi)) * 2.0 / 3.0
55
-        ret += (150.0 * sin(x / 12.0 * .pi) + 300.0 * sin(x / 30.0 * .pi)) * 2.0 / 3.0
56
-        return ret
57
-    }
58
-}

+ 5 - 4
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIColorExt.swift

@@ -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
 }

+ 4 - 5
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIViewExt.swift

@@ -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
 }

BIN
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/.DS_Store


+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/AlertViewController.swift

@@ -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
     }

BIN
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/.DS_Store


+ 0 - 121
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/BottomView.swift

@@ -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
-}

+ 0 - 78
PaiAi/PaiaiUIKit/Reusable/UIKit/Encryption/AES.swift

@@ -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
-}

+ 0 - 17
PaiAi/PaiaiUIKit/Reusable/UIKit/Encryption/Data+bytes.swift

@@ -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
-}

+ 0 - 116
PaiAi/PaiaiUIKit/Reusable/UIKit/Encryption/Digest.swift

@@ -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
-}

+ 0 - 128
PaiAi/PaiaiUIKit/Reusable/UIKit/Encryption/RSA.swift

@@ -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
-}

+ 0 - 29
PaiAi/PaiaiUIKit/Reusable/UIKit/Encryption/String+bytes.swift

@@ -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
-}

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationController/NavigationBar.swift

@@ -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
         }

+ 0 - 28
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/ColorQR.swift

@@ -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
 

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/QRCodeScanView.swift

@@ -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
 

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/SideViewController/SideViewController.swift

@@ -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
 

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/WaterfallFlowLayout/WaterfallFlowLayout.swift

@@ -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
     }

+ 3 - 6
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/GestureRecognizerDelegate/GestureRecognizerProxy.swift

@@ -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
 

+ 0 - 19
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationBarDelegate/NavigationBarDelegate.swift

@@ -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
-}

+ 0 - 41
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationBarDelegate/NavigationBarProxy.swift

@@ -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
-}

+ 6 - 6
PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetailViewController.swift

@@ -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
 

+ 1 - 1
PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupNameModificationViewController.swift

@@ -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() {

+ 7 - 7
PaiAi/Paiai_iOS/App/Group/GroupQRView.swift

@@ -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)

+ 6 - 6
PaiAi/Paiai_iOS/App/Group/GroupViewController.swift

@@ -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
 }

+ 3 - 2
PaiAi/Paiai_iOS/App/Home/CreateGroupViewController.swift

@@ -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
         }

+ 2 - 2
PaiAi/Paiai_iOS/App/Message/MessageCommentAndThumbupCell.swift

@@ -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

+ 1 - 1
PaiAi/Paiai_iOS/App/Message/MessageSystemCell.swift

@@ -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
 }

+ 3 - 3
PaiAi/Paiai_iOS/App/Mine/GroupCell.swift

@@ -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
 }

+ 4 - 4
PaiAi/Paiai_iOS/App/PhotoCell.swift

@@ -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
 }

+ 2 - 2
PaiAi/Paiai_iOS/App/PhotoDetail/ImageCell.swift

@@ -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

+ 26 - 30
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoDetail.storyboard

@@ -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"/>

+ 1 - 1
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoDetailCommentCell.swift

@@ -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
 }

+ 7 - 7
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoDetailViewController.swift

@@ -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
 

优化导航栏 push 和 pop 动画效果 · 2cde165abd - Gogs: Go Git Service

优化导航栏 push 和 pop 动画效果

FFIB 6 anos atrás
pai
commit
2cde165abd

BIN
PaiAi/.DS_Store


+ 5 - 1
PaiAi/Paiai.xcodeproj/project.pbxproj

@@ -181,6 +181,7 @@
181 181
 		0543E80F21D1FD1100A42807 /* GroupDetailItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0543E80E21D1FD1100A42807 /* GroupDetailItem.swift */; };
182 182
 		0546D9852242460700742939 /* OriginData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0546D9842242460700742939 /* OriginData.swift */; };
183 183
 		054B6C45223F884600939FE6 /* PhotoDetailRemoteAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 054B6C44223F884600939FE6 /* PhotoDetailRemoteAPI.swift */; };
184
+		054D8398228288FD0074561A /* NavigationBarConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 054D8397228288FD0074561A /* NavigationBarConfiguration.swift */; };
184 185
 		05594BFF2240BEDE002D4910 /* PhotoDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05594BFE2240BEDE002D4910 /* PhotoDetailViewModel.swift */; };
185 186
 		05594C012240BF9C002D4910 /* PhotoPurchaseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05594C002240BF9C002D4910 /* PhotoPurchaseViewModel.swift */; };
186 187
 		05594C032240E94E002D4910 /* PhotoDetailImageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05594C022240E94E002D4910 /* PhotoDetailImageCell.swift */; };
@@ -436,6 +437,7 @@
436 437
 		054863661FA326CB00A39DA0 /* PhotoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoCell.swift; sourceTree = "<group>"; };
437 438
 		054863671FA326CB00A39DA0 /* PhotoCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PhotoCell.xib; sourceTree = "<group>"; };
438 439
 		054B6C44223F884600939FE6 /* PhotoDetailRemoteAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoDetailRemoteAPI.swift; sourceTree = "<group>"; };
440
+		054D8397228288FD0074561A /* NavigationBarConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarConfiguration.swift; sourceTree = "<group>"; };
439 441
 		05594BFE2240BEDE002D4910 /* PhotoDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoDetailViewModel.swift; sourceTree = "<group>"; };
440 442
 		05594C002240BF9C002D4910 /* PhotoPurchaseViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoPurchaseViewModel.swift; sourceTree = "<group>"; };
441 443
 		05594C022240E94E002D4910 /* PhotoDetailImageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoDetailImageCell.swift; sourceTree = "<group>"; };
@@ -642,6 +644,7 @@
642 644
 			children = (
643 645
 				05AF61BE226EFAF700AD8E2F /* NavigationBar.swift */,
644 646
 				05EE558A226F070B00E13460 /* NavigationController.swift */,
647
+				054D8397228288FD0074561A /* NavigationBarConfiguration.swift */,
645 648
 			);
646 649
 			path = NavigationController;
647 650
 			sourceTree = "<group>";
@@ -1595,7 +1598,7 @@
1595 1598
 			);
1596 1599
 			runOnlyForDeploymentPostprocessing = 0;
1597 1600
 			shellPath = /bin/sh;
1598
-			shellScript = "/usr/local/bin/carthage copy-frameworks\nif which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
1601
+			shellScript = "/usr/local/bin/carthage copy-frameworks\n";
1599 1602
 		};
1600 1603
 /* End PBXShellScriptBuildPhase section */
1601 1604
 
@@ -1652,6 +1655,7 @@
1652 1655
 				05130F5A21C94C12004EF1BE /* PresentDisappearAnimatedTransitioning.swift in Sources */,
1653 1656
 				053E126721F1719F00A64893 /* PageItem.swift in Sources */,
1654 1657
 				053E127821F5B6E400A64893 /* AlertController.swift in Sources */,
1658
+				054D8398228288FD0074561A /* NavigationBarConfiguration.swift in Sources */,
1655 1659
 				05C5285621FE98F50090ECB5 /* GestureRecognizerProxy.swift in Sources */,
1656 1660
 				05130F5921C94C12004EF1BE /* AlertViewController.swift in Sources */,
1657 1661
 				05EE558B226F070B00E13460 /* NavigationController.swift in Sources */,

BIN
PaiAi/Paiai.xcodeproj/project.xcworkspace/xcuserdata/FFIB.xcuserdatad/UserInterfaceState.xcuserstate


+ 9 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIImageExt.swift

@@ -22,9 +22,17 @@ public extension UIImage {
22 22
         let renderer = UIGraphicsImageRenderer(size: outputSize)
23 23
         return renderer.jpegData(withCompressionQuality: quality) { _ in
24 24
             let content = UIGraphicsGetCurrentContext()
25
-            content?.draw(cgImage!, in: CGRect.init(origin: CGPoint.zero, size: outputSize))
25
+            content?.draw(cgImage!, in: CGRect(origin: CGPoint.zero, size: outputSize))
26 26
         }
27 27
     }
28
+    
29
+    func combineTo(image: UIImage, proportion: CGFloat, size: CGSize) {
30
+        let renderer = UIGraphicsImageRenderer(size: size)
31
+        renderer.image(actions: { context in
32
+            context.currentImage.draw(in: CGRect.init(x: 0, y: 0, width: size.width * proportion, height: size.height))
33
+            image.draw(in: CGRect.init(x: size.width * proportion, y: 0, width: size.width * (1 - proportion), height: size.height))
34
+        })
35
+    }
28 36
 }
29 37
 
30 38
 public extension UIImage {

+ 54 - 183
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationController/NavigationBar.swift

@@ -9,52 +9,7 @@
9 9
 import UIKit
10 10
 
11 11
 class NavigationBar: UINavigationBar {
12
-
13
-    private var currBgImage: UIImage?
14
-    private var targetBgImage: UIImage?
15
-    private var originShadowImage: UIImage?
16
-
17
-    private var hasChangedBgImage: Bool = false
18
-    private var hasChangedShadow: Bool = false
19
-    private var titleView: UIView?
20
-
21
-    var needsInteractive: Bool {
22
-        return hasChangedBgImage || hasChangedShadow
23
-    }
24
-    var bounce: Bounce = .none
25
-    var isPush: Bool = true
26
-
27
-    override var shadowImage: UIImage? {
28
-        didSet {
29
-            originShadowImage = oldValue
30
-            hasChangedShadow = true
31
-        }
32
-    }
33
-
34
-    lazy var fakeView: UIVisualEffectView = {
35
-        let val = UIVisualEffectView(effect: UIBlurEffect(style: .light))
36
-        val.frame = getNavigationBarBounds()
37
-        val.isUserInteractionEnabled = false
38
-        val.autoresizingMask = [.flexibleWidth, .flexibleHeight]
39
-
40
-        return val
41
-    }()
42
-
43
-    lazy var backgroundImageView: UIImageView = {
44
-        let view = UIImageView()
45
-        view.isUserInteractionEnabled = false
46
-        view.frame = getNavigationBarBounds().offsetBy(dx: bounds.width, dy: 0)
47
-
48
-        return view
49
-    }()
50
-
51
-    lazy var shadowImageView: UIImageView = {
52
-        let view = UIImageView()
53
-        view.frame = CGRect(x: 0, y: bounds.height, width: bounds.width, height: 0.5)
54
-
55
-        return view
56
-    }()
57
-
12
+    
58 13
     override init(frame: CGRect) {
59 14
         super.init(frame: frame)
60 15
     }
@@ -62,170 +17,86 @@ class NavigationBar: UINavigationBar {
62 17
     required init?(coder aDecoder: NSCoder) {
63 18
         fatalError("init(coder:) has not been implemented")
64 19
     }
65
-    override func setBackgroundImage(_ backgroundImage: UIImage?, for barMetrics: UIBarMetrics) {
66
-        currBgImage = self.backgroundImage(for: .default)
67
-        targetBgImage = backgroundImage
68
-        hasChangedBgImage = true
69
-    }
70 20
 
71
-    override func setBackgroundImage(_ backgroundImage: UIImage?,
72
-                                     for barPosition: UIBarPosition,
73
-                                     barMetrics: UIBarMetrics) {
74
-        currBgImage = self.backgroundImage(for: .default)
75
-        targetBgImage = backgroundImage
76
-        hasChangedBgImage = true
21
+    func getNavigationBarBounds() -> CGRect {
22
+        let statusHeight = UIApplication.shared.statusBarFrame.height
23
+        return CGRect(x: 0, y: -statusHeight, width: bounds.width, height: bounds.height + statusHeight)
77 24
     }
78 25
 
79
-    func setBackgroundImage() {
80
-        super.setBackgroundImage(targetBgImage, for: .any, barMetrics: .default)
26
+    override func value(forUndefinedKey key: String) -> Any? {
27
+        return nil
81 28
     }
29
+}
82 30
 
31
+public extension UINavigationBar {
83 32
     func getBarBackground() -> UIView? {
84
-       return value(forKeyPath: "_backgroundView") as? UIView
33
+        return value(forKeyPath: "_backgroundView") as? UIView
85 34
     }
86
-
87
-    func getContentView() -> UIView? {
35
+    
36
+    func getBarContentView() -> UIView? {
88 37
         for val in subviews {
89
-            if let contentClass = NSClassFromString("_UINavigationBarContentView"), val.isKind(of: contentClass) {
38
+            if let contentClass = NSClassFromString("_UINavigationBarContentView"),
39
+                val.isKind(of: contentClass) {
90 40
                 return val
91 41
             }
92 42
         }
93 43
         return nil
94 44
     }
95
-
45
+    
96 46
     func getShadowView() -> UIView? {
97 47
         guard let barBackground = getBarBackground() else { return nil }
98
-        for val in barBackground.subviews where val.bounds.height == 0.5 {
99
-            return val
48
+        for view in barBackground.subviews where view.bounds.height == 0.5 {
49
+            return view
100 50
         }
101 51
         return nil
102 52
     }
103
-
104
-    func getNavigationBarBounds() -> CGRect {
105
-        let statusHeight = UIApplication.shared.statusBarFrame.height
106
-        return CGRect(x: 0, y: -statusHeight, width: bounds.width, height: bounds.height + statusHeight)
53
+    
54
+    internal func apply(for configure: NavigationBarConfiguration) {
55
+        isHidden = configure.isHidden
56
+        isTranslucent = configure.isTranslucent
57
+        
58
+        barStyle = configure.barStyle
59
+        shadowImage = configure.shadowImage
60
+        setBackgroundImage(configure.backgroundImage, for: .default)
107 61
     }
108
-
109
-    override func value(forUndefinedKey key: String) -> Any? {
110
-        return nil
62
+    
63
+    internal convenience init(configure: NavigationBarConfiguration) {
64
+        self.init()
65
+        apply(for: configure)
111 66
     }
112 67
 }
113 68
 
114
-/// NavigationBar transition
115
-extension NavigationBar {
116
-    func constructViewHierarchy() {
117
-        setupShadowView()
118
-        setupBackgroundImageView()
119
-
120
-        guard let barBackground = getBarBackground() else { return }
121
-
122
-        insertSubview(shadowImageView, aboveSubview: barBackground)
123
-        insertSubview(backgroundImageView, aboveSubview: barBackground)
124
-        insertSubview(fakeView, belowSubview: backgroundImageView)
125
-        layoutIfNeeded()
126
-    }
127
-
128
-    private func setupShadowView() {
129
-        if let image = originShadowImage, image.size == CGSize.zero {
130
-            shadowImageView.image = image
131
-        } else {
132
-            shadowImageView.backgroundColor = UIColor(red: 0, green: 0, blue: 0,
133
-                                                      alpha: 77.0 / 255)
134
-        }
135
-
136
-        shadowImageView.alpha = originShadowImage == nil ? 1 : 0
137
-        getShadowView()?.isHidden = true
138
-    }
139
-
140
-    private func setupBackgroundImageView() {
141
-        if isPush {
142
-            fakeView.alpha = 0
143
-            backgroundImageView.image = targetBgImage
144
-        } else {
145
-            setBackgroundImage()
146
-            fakeView.alpha = 1
147
-            backgroundImageView.image = currBgImage
148
-        }
149
-    }
150
-
151
-    /// interactivePopGestureRecognizer
152
-    func transitionAnimationWithPercent(_ percent: CGFloat) {
153
-        switch bounce {
154
-        case .forward, .none:
155
-            transitionShadowAnimationWithPercent(percent)
156
-            transitionBackgroundAnimationWithPercent(percent)
157
-        case .backward:
158
-            transitionShadowAnimationWithPercent(1 - percent)
159
-            transitionBackgroundAnimationWithPercent(1 - percent)
160
-        }
161
-    }
162
-
163
-    func transitionAnimation() {
164
-        transitionShadowAnimation()
165
-        transitionBackgroundAnimation()
166
-    }
167
-
168
-    private func transitionShadowAnimation() {
169
-        guard hasChangedShadow else { return }
170
-        shadowImageView.alpha = originShadowImage == nil ? 0 : 1
171
-//        if originShadowImage == nil {
172
-//            shadowImageView.alpha = isInteractive ? (1 - percent) * 1 : 0
173
-//        } else {
174
-//            shadowImageView.alpha = isInteractive ? percent * 1 : 1
175
-//        }
69
+public extension UIToolbar {
70
+    func getBarBackground() -> UIView? {
71
+        return value(forKeyPath: "_backgroundView") as? UIView
176 72
     }
177
-
178
-    private func transitionBackgroundAnimation() {
179
-        guard hasChangedBgImage else { return }
180
-        if isPush {
181
-            fakeView.alpha = 1
182
-            backgroundImageView.frame.origin.x = 0
183
-        } else {
184
-            fakeView.alpha = 0
185
-            backgroundImageView.frame.origin.x = bounds.width
73
+    
74
+    func getShadowView() -> UIView? {
75
+        guard let barBackground = getBarBackground() else { return nil }
76
+        for view in barBackground.subviews where view.bounds.height == 0.5 {
77
+            return view
186 78
         }
79
+        return nil
187 80
     }
188
-
189
-    private func transitionShadowAnimationWithPercent(_ percent: CGFloat) {
190
-        guard hasChangedShadow else { return }
191
-        shadowImageView.alpha = originShadowImage == nil ? (1 - percent) * 1 : percent * 1
192
-    }
193
-
194
-    private func transitionBackgroundAnimationWithPercent(_ percent: CGFloat) {
195
-        guard hasChangedBgImage else { return }
196
-        fakeView.alpha = (1 - percent) * 1
197
-        backgroundImageView.frame.origin.x = percent * bounds.width
198
-    }
199
-
200
-    func clear() {
201
-
202
-        if isPush && hasChangedBgImage { setBackgroundImage() }
203
-
204
-        if !isPush && bounce == .backward && hasChangedBgImage {
205
-            targetBgImage = currBgImage
206
-            setBackgroundImage()
207
-        }
208
-
209
-        getShadowView()?.isHidden = false
210
-
211
-        fakeView.removeFromSuperview()
212
-        shadowImageView.removeFromSuperview()
213
-        backgroundImageView.removeFromSuperview()
214
-
215
-        currBgImage = nil
216
-        targetBgImage = nil
217
-
218
-        hasChangedBgImage = false
219
-        hasChangedShadow = false
220
-
221
-        bounce = .none
81
+    
82
+    internal convenience init(configure: NavigationBarConfiguration) {
83
+        self.init()
84
+        isHidden = configure.isHidden
85
+        isTranslucent = configure.isTranslucent
86
+        
87
+        barStyle = configure.barStyle
88
+        setShadowImage(configure.shadowImage, forToolbarPosition: .any)
89
+        setBackgroundImage(configure.backgroundImage, forToolbarPosition: .any, barMetrics: .default)
222 90
     }
223 91
 }
224 92
 
225
-extension NavigationBar {
226
-    enum Bounce {
227
-        case none
228
-        case backward
229
-        case forward
93
+extension UIViewController {
94
+    internal func getFakeBarFrame(for navigationBar: UINavigationBar) -> CGRect? {
95
+        guard let backgroundView = navigationBar.getBarBackground(),
96
+            var frame = backgroundView.superview?.convert(backgroundView.frame, to: self.view)
97
+            else { return nil }
98
+        
99
+        frame.origin.x = self.view.bounds.origin.x
100
+        return frame
230 101
     }
231 102
 }

+ 50 - 0
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationController/NavigationBarConfiguration.swift

@@ -0,0 +1,50 @@
1
+//
2
+//  NavigationBarConfiguration.swift
3
+//  PaiaiUIKit
4
+//
5
+//  Created by ffib on 2019/5/8.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+
11
+struct NavigationBarConfiguration {
12
+    var isHidden: Bool
13
+    var isTranslucent: Bool
14
+    
15
+    var barStyle: UIBarStyle
16
+    var shadowImage: UIImage?
17
+    var backgroundImage: UIImage?
18
+    
19
+    static var `default`: NavigationBarConfiguration {
20
+        return NavigationBarConfiguration()
21
+    }
22
+    
23
+    static var transparent: NavigationBarConfiguration {
24
+        return NavigationBarConfiguration(isHidden: false, isTranslucent: true,
25
+                                          shadowImage: UIImage(), backgroundImage: UIImage())
26
+    }
27
+    
28
+    init(isHidden: Bool = false,
29
+         isTranslucent: Bool = false,
30
+         tintColor: UIColor = .black,
31
+         shadowImage: UIImage? = nil,
32
+         barTintColor: UIColor? = nil,
33
+         backgroundImage: UIImage? = nil,
34
+         barStyle: UIBarStyle = .default,
35
+         titleTextAttributes: [NSAttributedString.Key: Any] = [:]) {
36
+        self.isHidden = isHidden
37
+        self.barStyle = barStyle
38
+        self.shadowImage = shadowImage
39
+        self.isTranslucent = isTranslucent
40
+        self.backgroundImage = backgroundImage
41
+    }
42
+    
43
+    init(navigationBar: UINavigationBar) {
44
+        isHidden = navigationBar.isHidden
45
+        barStyle = navigationBar.barStyle
46
+        shadowImage = navigationBar.shadowImage
47
+        isTranslucent = navigationBar.isTranslucent
48
+        backgroundImage = navigationBar.backgroundImage(for: .default)
49
+    }
50
+}

+ 90 - 55
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationController/NavigationController.swift

@@ -9,7 +9,13 @@
9 9
 import UIKit
10 10
 
11 11
 public class NavigationController: UINavigationController {
12
-
12
+    
13
+    private var operation: Operation = .none
14
+    private var barConfigures: [UIViewController?: NavigationBarConfiguration] = [:]
15
+    
16
+    private var _fromFakeBar = UIToolbar()
17
+    private var _toFakeBar = UIToolbar()
18
+    
13 19
     override public init(rootViewController: UIViewController) {
14 20
         super.init(navigationBarClass: NavigationBar.classForCoder(), toolbarClass: nil)
15 21
         self.viewControllers = [rootViewController]
@@ -28,41 +34,67 @@ public class NavigationController: UINavigationController {
28 34
         delegate = self
29 35
         interactivePopGestureRecognizer?.delegate = self
30 36
         interactivePopGestureRecognizer?.isEnabled = true
31
-
32
-        interactivePopGestureRecognizer?.addTarget(self,
33
-                                                   action: #selector(handlePop(gestureRecognizer:)))
34 37
     }
38
+    
39
+    public override func viewDidLayoutSubviews() {
40
+        super.viewDidLayoutSubviews()
41
+        if operation == .none { return }
42
+        navigationBar.getBarBackground()?.alpha = 0
43
+    }
44
+}
35 45
 
36
-    @objc
37
-    private func handlePop(gestureRecognizer: UIPanGestureRecognizer) {
38
-        guard let navBar = navigationBar as? NavigationBar else { return }
39
-        if gestureRecognizer.state == .began { navBar.isPush = false }
40
-
41
-        guard navBar.needsInteractive else { return }
42
-
43
-        let percent = gestureRecognizer.translation(in: view).x / view.bounds.width
44
-
45
-        if gestureRecognizer.state == .began || gestureRecognizer.state == .changed {
46
-            navBar.transitionAnimationWithPercent(percent)
46
+fileprivate extension NavigationController {
47
+    
48
+    func setFakeNavigationBar() {
49
+        UIView.setAnimationsEnabled(false)
50
+        guard let to = transitionCoordinator?.viewController(forKey: .to),
51
+            let from = transitionCoordinator?.viewController(forKey: .from) else { return }
52
+        
53
+        switch self.operation {
54
+        case .push:
55
+            barConfigures[to] = NavigationBarConfiguration(navigationBar: navigationBar)
56
+        case .pop:
57
+            navigationBar.setBackgroundImage(barConfigures[to]?.backgroundImage, for: .default)
58
+        default:
59
+            break
47 60
         }
61
+        
62
+        setToFakeNavigationBar(for: to)
63
+        setFromFakeNavigationBar(for: from)
64
+        
65
+        navigationBar.apply(for: .transparent)
66
+        UIView.setAnimationsEnabled(true)
67
+        
68
+        if barConfigures[to]?.isHidden != barConfigures[from]?.isHidden {
69
+            setNavigationBarHidden(barConfigures[to]?.isHidden ?? false, animated: true)
70
+        }
71
+    }
48 72
 
49
-        guard gestureRecognizer.state == .ended
50
-            || gestureRecognizer.state == .cancelled
51
-            || gestureRecognizer.state == .failed,
52
-            let coordinator = transitionCoordinator else { return }
53
-
54
-        navBar.bounce = percent < 0.5 ? .backward : .forward
55
-        let durationPercent = Double(percent < 0.5 ? coordinator.percentComplete : (1 - coordinator.percentComplete))
56
-        UIView.animate(withDuration: coordinator.transitionDuration * durationPercent,
57
-                       delay: 0,
58
-                       usingSpringWithDamping: 1,
59
-                       initialSpringVelocity: coordinator.completionVelocity,
60
-                       options: [],
61
-                       animations: {
62
-                        navBar.transitionAnimationWithPercent(1)
63
-        }, completion: { _ in
64
-            navBar.clear()
65
-        })
73
+    func setFromFakeNavigationBar(for from: UIViewController) {
74
+        if let navBarFrame = from.getFakeBarFrame(for: navigationBar) {
75
+            _fromFakeBar = UIToolbar(configure: barConfigures[from] ?? .default)
76
+            _fromFakeBar.delegate = self
77
+            _fromFakeBar.frame = navBarFrame
78
+            from.view.addSubview(_fromFakeBar)
79
+        }
80
+    }
81
+    
82
+    func setToFakeNavigationBar(for to: UIViewController) {
83
+        if let navBarFrame = to.getFakeBarFrame(for: navigationBar) {
84
+            _toFakeBar = UIToolbar(configure: barConfigures[to] ?? .default)
85
+            _toFakeBar.delegate = self
86
+            _toFakeBar.frame = navBarFrame
87
+            to.view.addSubview(_toFakeBar)
88
+        }
89
+    }
90
+    
91
+    func clearFake() {
92
+        _fromFakeBar.removeFromSuperview()
93
+        _toFakeBar.removeFromSuperview()
94
+        
95
+        guard let from = transitionCoordinator?.viewController(forKey: .from),
96
+            operation == .pop else { return }
97
+        barConfigures.removeValue(forKey: from)
66 98
     }
67 99
 }
68 100
 
@@ -72,37 +104,34 @@ extension NavigationController: UINavigationControllerDelegate {
72 104
                                      animationControllerFor operation: UINavigationController.Operation,
73 105
                                      from fromVC: UIViewController,
74 106
                                      to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
75
-        (navigationBar as? NavigationBar)?.isPush = operation == .push
107
+        self.operation = operation
76 108
         return nil
77 109
     }
78 110
 
79 111
     public func navigationController(_ navigationController: UINavigationController,
80 112
                                      willShow viewController: UIViewController,
81 113
                                      animated: Bool) {
82
-        guard let navBar = navigationBar as? NavigationBar,
83
-            navBar.needsInteractive else { return }
84
-
85
-        guard let coordinator = transitionCoordinator,
86
-            animated else {
87
-                navBar.setBackgroundImage()
88
-                navBar.clear()
89
-                return
114
+        if operation == .none {
115
+            self.barConfigures[viewController] = NavigationBarConfiguration(navigationBar: navigationBar)
116
+            return
90 117
         }
91
-
92
-        navBar.constructViewHierarchy()
93
-
94
-        guard !coordinator.isInteractive else { return }
95
-
96
-        coordinator.animate(alongsideTransition: { (transitionContext) in
97
-            DispatchQueue.main.async {
98
-                UIView.beginAnimations(nil, context: nil)
99
-                UIView.setAnimationCurve(transitionContext.completionCurve)
100
-                UIView.setAnimationDuration(transitionContext.transitionDuration)
101
-                navBar.transitionAnimation()
102
-                UIView.commitAnimations()
118
+        
119
+        transitionCoordinator?.animate(alongsideTransition: { context in
120
+            if context.isInteractive {
121
+                self.operation = .pop
122
+            }
123
+            self.setFakeNavigationBar()
124
+        }, completion: { context in
125
+            let vc: UIViewController?
126
+            if context.isCancelled {
127
+                self.operation = .push
128
+                vc = context.viewController(forKey: .from)
129
+            } else {
130
+                vc = context.viewController(forKey: .to)
103 131
             }
104
-        }, completion: { (_) in
105
-            navBar.clear()
132
+            self.navigationBar.getBarBackground()?.alpha = 1
133
+            self.navigationBar.apply(for: self.barConfigures[vc] ?? .default)
134
+            self.clearFake()
106 135
         })
107 136
     }
108 137
 }
@@ -115,3 +144,9 @@ extension NavigationController: UIGestureRecognizerDelegate {
115 144
         return true
116 145
     }
117 146
 }
147
+
148
+extension NavigationController: UIToolbarDelegate {
149
+    public func position(for bar: UIBarPositioning) -> UIBarPosition {
150
+        return .top
151
+    }
152
+}

+ 3 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/PageViewController/PageViewController.swift

@@ -69,7 +69,9 @@ open class PageViewController: UIViewController {
69 69
         contentRect = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height)
70 70
 
71 71
         if #available(iOS 11, *) {
72
-            scrollView.contentInsetAdjustmentBehavior = .never
72
+            scrollView.contentInsetAdjustmentBehavior = .automatic
73
+        } else {
74
+            automaticallyAdjustsScrollViewInsets = false
73 75
         }
74 76
 
75 77
         constructViewHierarchy()

+ 5 - 4
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/QRCodeScanView.swift

@@ -82,14 +82,15 @@ import CoreImage
82 82
     }
83 83
 
84 84
     @objc func start() {
85
-        let queue = DispatchQueue(label: "FFIB.startScan.com")
86
-        queue.async {
87
-            self.qrscanner?.startScan()
85
+//        let queue = DispatchQueue(label: "FFIB.startScan.com")
86
+//        queue.async {
87
+        
88 88
             DispatchQueue.main.async {
89
+                self.qrscanner?.startScan()
89 90
                 self.qrmaskView?.startAnimation()
90 91
                 self.indicatorView.stopAnimating()
91 92
             }
92
-        }
93
+//        }
93 94
     }
94 95
 
95 96
     public func openLight() {

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/QRCodeScanner.swift

@@ -83,7 +83,7 @@ class QRCodeScanner: NSObject {
83 83
     }
84 84
     func startScan() {
85 85
         setScanArea()
86
-        captureSession.startRunning()
86
+//        captureSession.startRunning()
87 87
     }
88 88
 
89 89
     func stopScan() {

+ 3 - 1
PaiAi/Paiai_iOS/App/AppCoordinator.swift

@@ -70,11 +70,13 @@ fileprivate extension AppCoordinator {
70 70
 
71 71
         let homeCoordinator = HomeCoordinator(homeVC,
72 72
                                               navigationController: navigationController,
73
+                                              containerViewController: containerViewController,
73 74
                                               userInfoViewModel: shareUserInfoViewModel)
74 75
         coordinate(to: homeCoordinator).subscribe().disposed(by: disposeBag)
75 76
 
76 77
         let messageCoordinator = MessageCoordinator(messageVC,
77
-                                                    navigationController: navigationController)
78
+                                                    navigationController: navigationController,
79
+                                                    containerViewController: containerViewController)
78 80
         coordinate(to: messageCoordinator).subscribe().disposed(by: disposeBag)
79 81
 
80 82
         containerViewController.pageItems = [PageItem(title: "首页",

+ 1 - 0
PaiAi/Paiai_iOS/App/ContainerViewController.swift

@@ -61,6 +61,7 @@ public final class ContainerViewController: PageViewController {
61 61
     }
62 62
 
63 63
     func setupNavigationBar() {
64
+        navigationController?.navigationBar.isTranslucent = true
64 65
         navigationController?.navigationBar.shadowImage = UIImage()
65 66
         navigationController?.navigationBar.tintColor = UIColor.white
66 67
         navigationController?.navigationBar.barTintColor = UIColor.white

+ 2 - 2
PaiAi/Paiai_iOS/App/Group/GroupViewController.swift

@@ -52,10 +52,10 @@ final class GroupViewController: UIViewController {
52 52
     override func viewDidLoad() {
53 53
         super.viewDidLoad()
54 54
         initalize()
55
+        navigationController?.navigationBar.setBackgroundImage(UIImage.Navigation.background, for: .default)
55 56
     }
56 57
 
57 58
     override func viewWillAppear(_ animated: Bool) {
58
-        navigationController?.navigationBar.setBackgroundImage(UIImage.Navigation.background, for: .default)
59 59
         super.viewWillAppear(animated)
60 60
     }
61 61
 
@@ -82,7 +82,7 @@ final class GroupViewController: UIViewController {
82 82
     }
83 83
 
84 84
     deinit {
85
-        collectionView.endAllRefreshing()
85
+        collectionView.removeAllPullToRefresh()
86 86
     }
87 87
 }
88 88
 

+ 3 - 1
PaiAi/Paiai_iOS/App/Home/HomeCoordinator.swift

@@ -13,14 +13,16 @@ import PaiaiDataKit
13 13
 class HomeCoordinator: BaseCoordinator<Void> {
14 14
 
15 15
     var homeViewController: HomeViewController
16
+    var containerViewController: ContainerViewController
16 17
     var shareUserInfoViewModel: UserInfoViewModel
17 18
 
18 19
     init(_ viewController: HomeViewController,
19 20
          navigationController: UINavigationController,
21
+         containerViewController: ContainerViewController,
20 22
          userInfoViewModel: UserInfoViewModel) {
21 23
         self.homeViewController = viewController
22 24
         self.shareUserInfoViewModel = userInfoViewModel
23
-
25
+        self.containerViewController = containerViewController
24 26
         super.init(navigationController: navigationController, viewController: viewController)
25 27
     }
26 28
 

+ 2 - 2
PaiAi/Paiai_iOS/App/Home/HomeViewController.swift

@@ -36,7 +36,7 @@ final class HomeViewController: UIViewController {
36 36
         collectionView.register(UINib(nibName: "PhotoCell",
37 37
                                       bundle: Bundle(identifier: "com.Paiai-iOS")),
38 38
                                 forCellWithReuseIdentifier: "photoCell")
39
-
39
+        
40 40
         setup()
41 41
         binding()
42 42
     }
@@ -62,7 +62,7 @@ final class HomeViewController: UIViewController {
62 62
     }
63 63
 
64 64
     deinit {
65
-        collectionView.endAllRefreshing()
65
+        collectionView.removeAllPullToRefresh()
66 66
     }
67 67
 }
68 68
 

+ 2 - 1
PaiAi/Paiai_iOS/App/Home/ScanQRViewController.swift

@@ -23,6 +23,7 @@ final class ScanQRViewController: UIViewController {
23 23
     override func viewDidLoad() {
24 24
         super.viewDidLoad()
25 25
         scanView.delegate = self
26
+        setNavigationBar()
26 27
         viewModel.join(code: "http://pai.ai/g/SpA5be3")
27 28
     }
28 29
 
@@ -32,8 +33,8 @@ final class ScanQRViewController: UIViewController {
32 33
     }
33 34
 
34 35
     override func viewWillAppear(_ animated: Bool) {
35
-        setNavigationBar()
36 36
         super.viewWillAppear(animated)
37
+        
37 38
     }
38 39
 
39 40
     override func viewWillDisappear(_ animated: Bool) {

+ 2 - 1
PaiAi/Paiai_iOS/App/Message/MessageCoordinator.swift

@@ -14,7 +14,8 @@ class MessageCoordinator: BaseCoordinator<Void> {
14 14
     fileprivate let messageViewController: MessageViewController
15 15
 
16 16
     init(_ viewController: MessageViewController,
17
-         navigationController: UINavigationController) {
17
+         navigationController: UINavigationController,
18
+         containerViewController: ContainerViewController) {
18 19
         messageViewController = viewController
19 20
         super.init(navigationController: navigationController, viewController: viewController)
20 21
     }

+ 1 - 1
PaiAi/Paiai_iOS/App/Message/MessageListViewController.swift

@@ -91,7 +91,7 @@ final class MessageListViewController: UIViewController {
91 91
     }
92 92
 
93 93
     deinit {
94
-        tableView.endAllRefreshing()
94
+        tableView.removeAllPullToRefresh()
95 95
     }
96 96
 }
97 97
 

+ 1 - 1
PaiAi/Paiai_iOS/App/Mine/MineGroupViewController.swift

@@ -58,7 +58,7 @@ final class MineGroupViewController: UIViewController {
58 58
     }
59 59
 
60 60
     deinit {
61
-        tableView.endAllRefreshing()
61
+        tableView.removeAllPullToRefresh()
62 62
     }
63 63
 }
64 64
 

+ 1 - 1
PaiAi/Paiai_iOS/App/Mine/MineOrderViewController.swift

@@ -55,7 +55,7 @@ final class MineOrderViewController: UIViewController {
55 55
     }
56 56
 
57 57
     deinit {
58
-        tableView.endAllRefreshing()
58
+        tableView.removeAllPullToRefresh()
59 59
     }
60 60
 }
61 61