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