Commit b6a6cbf4 authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  标题
  // 消息
  // 消息
  // 权限
parents 9d30e419 2625b6b5
...@@ -43,10 +43,11 @@ class YHServiceSectionView: UIView { ...@@ -43,10 +43,11 @@ class YHServiceSectionView: UIView {
collectinoView.register(YHServiceSectionCollectionViewCell.self, forCellWithReuseIdentifier:YHServiceSectionCollectionViewCell.cellReuseIdentifier) collectinoView.register(YHServiceSectionCollectionViewCell.self, forCellWithReuseIdentifier:YHServiceSectionCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self collectinoView.delegate = self
collectinoView.dataSource = self collectinoView.dataSource = self
collectinoView.showsVerticalScrollIndicator = false
collectinoView.translatesAutoresizingMaskIntoConstraints = false collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true collectinoView.alwaysBounceVertical = true
collectinoView.bounces = false
collectinoView.showsHorizontalScrollIndicator = false
collectinoView.showsVerticalScrollIndicator = false
return collectinoView return collectinoView
}() }()
......
...@@ -154,23 +154,31 @@ class YHMessageListVC: YHBaseViewController { ...@@ -154,23 +154,31 @@ class YHMessageListVC: YHBaseViewController {
self.viewModel.getUnreadMsgList { self.viewModel.getUnreadMsgList {
[weak self] success, error in [weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if success, let msgList = viewModel.msgList { if success {
msgArr.removeAll() msgArr.removeAll()
var hasUnreadMsg = false
// 资料填写 // 资料填写
if let infoMsg = msgList.information, !infoMsg.lastMessage.isEmpty { if !self.viewModel.msgList.information.lastMessage.isEmpty {
msgArr.append(infoMsg) hasUnreadMsg = true
} }
// 证件上传 // 证件上传
if let cerMsg = msgList.certificate, !cerMsg.lastMessage.isEmpty { if !self.viewModel.msgList.certificate.lastMessage.isEmpty {
msgArr.append(cerMsg) hasUnreadMsg = true
} }
// 文书定稿 // 文书定稿
if let dratMsg = msgList.draft, !dratMsg.lastMessage.isEmpty { if !self.viewModel.msgList.draft.lastMessage.isEmpty {
msgArr.append(dratMsg) hasUnreadMsg = true
} }
// 文件签字 // 文件签字
if let signMsg = msgList.signature, !signMsg.lastMessage.isEmpty { if !self.viewModel.msgList.signature.lastMessage.isEmpty {
msgArr.append(signMsg) hasUnreadMsg = true
}
if hasUnreadMsg {
msgArr.append(self.viewModel.msgList.information)
msgArr.append(self.viewModel.msgList.certificate)
msgArr.append(self.viewModel.msgList.draft)
msgArr.append(self.viewModel.msgList.signature)
} }
emptyDataTipsView.isHidden = msgArr.count > 0 emptyDataTipsView.isHidden = msgArr.count > 0
self.tableView.reloadData() self.tableView.reloadData()
......
...@@ -52,13 +52,16 @@ class YHMessageInfoModel: SmartCodable { ...@@ -52,13 +52,16 @@ class YHMessageInfoModel: SmartCodable {
} }
class YHMsgListModel: SmartCodable { class YHMsgListModel: SmartCodable {
var information: YHMessageInfoModel? var information: YHMessageInfoModel = YHMessageInfoModel()
var certificate: YHMessageInfoModel? var certificate: YHMessageInfoModel = YHMessageInfoModel()
var draft: YHMessageInfoModel? var draft: YHMessageInfoModel = YHMessageInfoModel()
var signature: YHMessageInfoModel? var signature: YHMessageInfoModel = YHMessageInfoModel()
required init() { required init() {
self.information.type = YHMessageType.infoFill.rawValue
self.certificate.type = YHMessageType.cerUpload.rawValue
self.draft.type = YHMessageType.draft.rawValue
self.signature.type = YHMessageType.fileSign.rawValue
} }
} }
......
...@@ -18,7 +18,7 @@ class YHMessageSessionCell: UITableViewCell { ...@@ -18,7 +18,7 @@ class YHMessageSessionCell: UITableViewCell {
var badgeLabel: UILabel! var badgeLabel: UILabel!
var nameLabel: UILabel! var nameLabel: UILabel!
var detailLabel: UILabel! var detailLabel: UILabel!
// var timeLabel: UILabel! var timeLabel: UILabel!
var bottomLineView: UIView! var bottomLineView: UIView!
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
...@@ -64,7 +64,8 @@ class YHMessageSessionCell: UITableViewCell { ...@@ -64,7 +64,8 @@ class YHMessageSessionCell: UITableViewCell {
} }
self.detailLabel.text = !model.lastMessage.isEmpty ? model.lastMessage : "暂无消息".local self.detailLabel.text = !model.lastMessage.isEmpty ? model.lastMessage : "暂无消息".local
// self.timeLabel.text = formatTimestamp(Double(model.lastMessageTime)) self.timeLabel.text = formatTimestamp(Double(model.lastMessageTime))
self.timeLabel.isHidden = model.lastMessage.isEmpty
} }
func formatTimestamp(_ timestamp: TimeInterval) -> String { func formatTimestamp(_ timestamp: TimeInterval) -> String {
...@@ -126,13 +127,13 @@ class YHMessageSessionCell: UITableViewCell { ...@@ -126,13 +127,13 @@ class YHMessageSessionCell: UITableViewCell {
detailLabel.font = UIFont.PFSC_R(ofSize:12) detailLabel.font = UIFont.PFSC_R(ofSize:12)
contentView.addSubview(detailLabel) contentView.addSubview(detailLabel)
// timeLabel = UILabel() timeLabel = UILabel()
// timeLabel.textColor = UIColor(hex:0x121A26, alpha: 0.3) timeLabel.textColor = UIColor(hex:0x121A26, alpha: 0.3)
// timeLabel.textAlignment = .right timeLabel.textAlignment = .right
// timeLabel.font = UIFont.PFSC_R(ofSize:11) timeLabel.font = UIFont.PFSC_R(ofSize:11)
// timeLabel.setContentCompressionResistancePriority(.required, for: .horizontal) timeLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
// timeLabel.setContentHuggingPriority(.required, for: .horizontal) timeLabel.setContentHuggingPriority(.required, for: .horizontal)
// contentView.addSubview(timeLabel) contentView.addSubview(timeLabel)
bottomLineView = UIView() bottomLineView = UIView()
bottomLineView.backgroundColor = UIColor(hex: 0xF0F3F7) bottomLineView.backgroundColor = UIColor(hex: 0xF0F3F7)
...@@ -158,22 +159,23 @@ class YHMessageSessionCell: UITableViewCell { ...@@ -158,22 +159,23 @@ class YHMessageSessionCell: UITableViewCell {
nameLabel.snp.makeConstraints { make in nameLabel.snp.makeConstraints { make in
make.left.equalTo(iconContentView.snp.right).offset(16) make.left.equalTo(iconContentView.snp.right).offset(16)
make.right.equalToSuperview().offset(-20) make.right.equalTo(timeLabel.snp.left).offset(-20)
make.top.equalTo(iconContentView) make.top.equalTo(iconContentView)
make.height.equalTo(21) make.height.equalTo(21)
} }
detailLabel.snp.makeConstraints { make in detailLabel.snp.makeConstraints { make in
make.left.right.equalTo(nameLabel) make.left.equalTo(nameLabel)
make.right.equalTo(timeLabel)
make.top.equalTo(nameLabel.snp.bottom).offset(2) make.top.equalTo(nameLabel.snp.bottom).offset(2)
make.height.equalTo(17) make.height.equalTo(17)
} }
// timeLabel.snp.makeConstraints { make in timeLabel.snp.makeConstraints { make in
// make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
// make.top.equalTo(nameLabel) make.top.equalTo(nameLabel)
// make.height.equalTo(15) make.height.equalTo(15)
// } }
bottomLineView.snp.makeConstraints { make in bottomLineView.snp.makeConstraints { make in
make.left.right.equalTo(detailLabel) make.left.right.equalTo(detailLabel)
......
...@@ -11,7 +11,7 @@ import SmartCodable ...@@ -11,7 +11,7 @@ import SmartCodable
class YHMsgViewModel: NSObject { class YHMsgViewModel: NSObject {
var msgList: YHMsgListModel? var msgList: YHMsgListModel = YHMsgListModel()
var msgDetailList : [YHDetailMessageModel] = [] var msgDetailList : [YHDetailMessageModel] = []
var unreadTotalCount: Int = 0 var unreadTotalCount: Int = 0
...@@ -19,26 +19,27 @@ class YHMsgViewModel: NSObject { ...@@ -19,26 +19,27 @@ class YHMsgViewModel: NSObject {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.unreadMsgListApi let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.unreadMsgListApi
let _ = YHNetRequest.getRequest(url: strUrl) { json, code in let _ = YHNetRequest.getRequest(url: strUrl) { json, code in
var dic = json.data let dic = json.data
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == 200 { if json.code == 200 {
guard let result = YHMsgListModel.deserialize(dict: dic as? Dictionary ) else { guard let result = YHMsgListModel.deserialize(dict: dic as? Dictionary ) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description()) let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
self.msgList = nil
callBackBlock(false, error) callBackBlock(false, error)
return return
} }
self.msgList = result self.msgList = result
self.msgList.information.type = YHMessageType.infoFill.rawValue
self.msgList.certificate.type = YHMessageType.cerUpload.rawValue
self.msgList.draft.type = YHMessageType.draft.rawValue
self.msgList.signature.type = YHMessageType.fileSign.rawValue
callBackBlock(true, nil) callBackBlock(true, nil)
} else { } else {
self.msgList = nil
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg) let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error) callBackBlock(false, error)
} }
} failBlock: { error in } failBlock: { error in
self.msgList = nil
callBackBlock(false, error) callBackBlock(false, error)
} }
} }
......
...@@ -90,6 +90,13 @@ class YHMyPermissionSettingVC: YHBaseViewController { ...@@ -90,6 +90,13 @@ class YHMyPermissionSettingVC: YHBaseViewController {
updateNetWorkStatus() updateNetWorkStatus()
// 2)获取相册权限 // 2)获取相册权限
requestAndUpdatePhotoPermission()
// 3)获取相机权限
requestAndUpdateCameraPermission()
}
func requestAndUpdatePhotoPermission() {
requestPhotoLibraryPermission { requestPhotoLibraryPermission {
[weak self] grant in [weak self] grant in
guard let self = self else { return } guard let self = self else { return }
...@@ -102,8 +109,9 @@ class YHMyPermissionSettingVC: YHBaseViewController { ...@@ -102,8 +109,9 @@ class YHMyPermissionSettingVC: YHBaseViewController {
} }
} }
} }
}
// 3)获取相机权限 func requestAndUpdateCameraPermission() {
requestCameraPermission { requestCameraPermission {
[weak self] grant in [weak self] grant in
guard let self = self else { return } guard let self = self else { return }
...@@ -132,13 +140,7 @@ class YHMyPermissionSettingVC: YHBaseViewController { ...@@ -132,13 +140,7 @@ class YHMyPermissionSettingVC: YHBaseViewController {
case .notDetermined: case .notDetermined:
// 尚未确定,请求授权 // 尚未确定,请求授权
PHPhotoLibrary.requestAuthorization { completion(false)
authorizationStatus in
self.requestPhotoLibraryPermission {
granted in
completion(granted)
}
}
@unknown default: @unknown default:
completion(false) completion(false)
...@@ -159,10 +161,7 @@ class YHMyPermissionSettingVC: YHBaseViewController { ...@@ -159,10 +161,7 @@ class YHMyPermissionSettingVC: YHBaseViewController {
case .notDetermined: case .notDetermined:
// 尚未确定,请求授权 // 尚未确定,请求授权
AVCaptureDevice.requestAccess(for: .video) { completion(false)
granted in
completion(granted)
}
@unknown default: @unknown default:
completion(false) completion(false)
...@@ -195,7 +194,33 @@ extension YHMyPermissionSettingVC: UITableViewDelegate, UITableViewDataSource { ...@@ -195,7 +194,33 @@ extension YHMyPermissionSettingVC: UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.row && indexPath.row < items.count {
let item = items[indexPath.row]
if item.type == .photo {
let status = PHPhotoLibrary.authorizationStatus()
if status == .notDetermined {
PHPhotoLibrary.requestAuthorization {
authorizationStatus in
self.requestPhotoLibraryPermission {
[weak self] granted in
guard let self = self else { return }
requestAndUpdatePhotoPermission()
}
}
return
}
}
if item.type == .camera {
let status = AVCaptureDevice.authorizationStatus(for: .video)
if status == .notDetermined {
AVCaptureDevice.requestAccess(for: .video) {
[weak self] granted in
guard let self = self else { return }
requestAndUpdateCameraPermission()
}
return
}
}
let url = URL(string: UIApplication.openSettingsURLString) let url = URL(string: UIApplication.openSettingsURLString)
if let url = url, UIApplication .shared.canOpenURL(url) { if let url = url, UIApplication .shared.canOpenURL(url) {
printLog("settingUrl:\(url)") printLog("settingUrl:\(url)")
...@@ -204,6 +229,7 @@ extension YHMyPermissionSettingVC: UITableViewDelegate, UITableViewDataSource { ...@@ -204,6 +229,7 @@ extension YHMyPermissionSettingVC: UITableViewDelegate, UITableViewDataSource {
}) })
} }
} }
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return UITableView.automaticDimension return UITableView.automaticDimension
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment