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 {
collectinoView.register(YHServiceSectionCollectionViewCell.self, forCellWithReuseIdentifier:YHServiceSectionCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
collectinoView.showsVerticalScrollIndicator = false
collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true
collectinoView.bounces = false
collectinoView.showsHorizontalScrollIndicator = false
collectinoView.showsVerticalScrollIndicator = false
return collectinoView
}()
......
......@@ -154,23 +154,31 @@ class YHMessageListVC: YHBaseViewController {
self.viewModel.getUnreadMsgList {
[weak self] success, error in
guard let self = self else { return }
if success, let msgList = viewModel.msgList {
if success {
msgArr.removeAll()
var hasUnreadMsg = false
// 资料填写
if let infoMsg = msgList.information, !infoMsg.lastMessage.isEmpty {
msgArr.append(infoMsg)
if !self.viewModel.msgList.information.lastMessage.isEmpty {
hasUnreadMsg = true
}
// 证件上传
if let cerMsg = msgList.certificate, !cerMsg.lastMessage.isEmpty {
msgArr.append(cerMsg)
if !self.viewModel.msgList.certificate.lastMessage.isEmpty {
hasUnreadMsg = true
}
// 文书定稿
if let dratMsg = msgList.draft, !dratMsg.lastMessage.isEmpty {
msgArr.append(dratMsg)
if !self.viewModel.msgList.draft.lastMessage.isEmpty {
hasUnreadMsg = true
}
// 文件签字
if let signMsg = msgList.signature, !signMsg.lastMessage.isEmpty {
msgArr.append(signMsg)
if !self.viewModel.msgList.signature.lastMessage.isEmpty {
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
self.tableView.reloadData()
......
......@@ -52,13 +52,16 @@ class YHMessageInfoModel: SmartCodable {
}
class YHMsgListModel: SmartCodable {
var information: YHMessageInfoModel?
var certificate: YHMessageInfoModel?
var draft: YHMessageInfoModel?
var signature: YHMessageInfoModel?
var information: YHMessageInfoModel = YHMessageInfoModel()
var certificate: YHMessageInfoModel = YHMessageInfoModel()
var draft: YHMessageInfoModel = YHMessageInfoModel()
var signature: YHMessageInfoModel = YHMessageInfoModel()
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 {
var badgeLabel: UILabel!
var nameLabel: UILabel!
var detailLabel: UILabel!
// var timeLabel: UILabel!
var timeLabel: UILabel!
var bottomLineView: UIView!
required init?(coder: NSCoder) {
......@@ -64,7 +64,8 @@ class YHMessageSessionCell: UITableViewCell {
}
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 {
......@@ -126,13 +127,13 @@ class YHMessageSessionCell: UITableViewCell {
detailLabel.font = UIFont.PFSC_R(ofSize:12)
contentView.addSubview(detailLabel)
// timeLabel = UILabel()
// timeLabel.textColor = UIColor(hex:0x121A26, alpha: 0.3)
// timeLabel.textAlignment = .right
// timeLabel.font = UIFont.PFSC_R(ofSize:11)
// timeLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
// timeLabel.setContentHuggingPriority(.required, for: .horizontal)
// contentView.addSubview(timeLabel)
timeLabel = UILabel()
timeLabel.textColor = UIColor(hex:0x121A26, alpha: 0.3)
timeLabel.textAlignment = .right
timeLabel.font = UIFont.PFSC_R(ofSize:11)
timeLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
timeLabel.setContentHuggingPriority(.required, for: .horizontal)
contentView.addSubview(timeLabel)
bottomLineView = UIView()
bottomLineView.backgroundColor = UIColor(hex: 0xF0F3F7)
......@@ -158,22 +159,23 @@ class YHMessageSessionCell: UITableViewCell {
nameLabel.snp.makeConstraints { make in
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.height.equalTo(21)
}
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.height.equalTo(17)
}
// timeLabel.snp.makeConstraints { make in
// make.right.equalToSuperview().offset(-20)
// make.top.equalTo(nameLabel)
// make.height.equalTo(15)
// }
timeLabel.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-20)
make.top.equalTo(nameLabel)
make.height.equalTo(15)
}
bottomLineView.snp.makeConstraints { make in
make.left.right.equalTo(detailLabel)
......
......@@ -11,7 +11,7 @@ import SmartCodable
class YHMsgViewModel: NSObject {
var msgList: YHMsgListModel?
var msgList: YHMsgListModel = YHMsgListModel()
var msgDetailList : [YHDetailMessageModel] = []
var unreadTotalCount: Int = 0
......@@ -19,26 +19,27 @@ class YHMsgViewModel: NSObject {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.unreadMsgListApi
let _ = YHNetRequest.getRequest(url: strUrl) { json, code in
var dic = json.data
let dic = json.data
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let result = YHMsgListModel.deserialize(dict: dic as? Dictionary ) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
self.msgList = nil
callBackBlock(false, error)
return
}
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)
} else {
self.msgList = nil
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { error in
self.msgList = nil
callBackBlock(false, error)
}
}
......
......@@ -90,6 +90,13 @@ class YHMyPermissionSettingVC: YHBaseViewController {
updateNetWorkStatus()
// 2)获取相册权限
requestAndUpdatePhotoPermission()
// 3)获取相机权限
requestAndUpdateCameraPermission()
}
func requestAndUpdatePhotoPermission() {
requestPhotoLibraryPermission {
[weak self] grant in
guard let self = self else { return }
......@@ -102,8 +109,9 @@ class YHMyPermissionSettingVC: YHBaseViewController {
}
}
}
}
// 3)获取相机权限
func requestAndUpdateCameraPermission() {
requestCameraPermission {
[weak self] grant in
guard let self = self else { return }
......@@ -132,13 +140,7 @@ class YHMyPermissionSettingVC: YHBaseViewController {
case .notDetermined:
// 尚未确定,请求授权
PHPhotoLibrary.requestAuthorization {
authorizationStatus in
self.requestPhotoLibraryPermission {
granted in
completion(granted)
}
}
completion(false)
@unknown default:
completion(false)
......@@ -159,10 +161,7 @@ class YHMyPermissionSettingVC: YHBaseViewController {
case .notDetermined:
// 尚未确定,请求授权
AVCaptureDevice.requestAccess(for: .video) {
granted in
completion(granted)
}
completion(false)
@unknown default:
completion(false)
......@@ -195,7 +194,33 @@ extension YHMyPermissionSettingVC: UITableViewDelegate, UITableViewDataSource {
}
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)
if let url = url, UIApplication .shared.canOpenURL(url) {
printLog("settingUrl:\(url)")
......@@ -204,6 +229,7 @@ extension YHMyPermissionSettingVC: UITableViewDelegate, UITableViewDataSource {
})
}
}
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
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