Commit 59f35b57 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:
  // 消息
  // 消息
  // 消息
  //  消息
  // 消息
  // 消息
  11版本包
  服务中心闪动问题
parents 70173896 e354f530
...@@ -2984,7 +2984,7 @@ ...@@ -2984,7 +2984,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 11; CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
...@@ -3185,7 +3185,7 @@ ...@@ -3185,7 +3185,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 11; CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
...@@ -3227,7 +3227,7 @@ ...@@ -3227,7 +3227,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 11; CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
......
...@@ -62,11 +62,11 @@ extension AppDelegate: JPUSHRegisterDelegate { ...@@ -62,11 +62,11 @@ extension AppDelegate: JPUSHRegisterDelegate {
} }
//后台进前台 //后台进前台
func applicationDidEnterBackground(_ application: UIApplication) { func applicationWillEnterForeground(_ application: UIApplication) {
//销毁通知红点 DispatchQueue.main.async {
// UIApplication.shared.applicationIconBadgeNumber = 0 // 请求消息页面通知权限通知
// JPUSHService.setBadge(0) NotificationCenter.default.post(name: YhConstant.YhNotification.didReqeustNotifyPermissionNotification, object: nil)
UNUserNotificationCenter.current().removeAllPendingNotificationRequests() }
} }
func jpushNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: ((Int) -> Void)) { func jpushNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: ((Int) -> Void)) {
...@@ -77,6 +77,13 @@ extension AppDelegate: JPUSHRegisterDelegate { ...@@ -77,6 +77,13 @@ extension AppDelegate: JPUSHRegisterDelegate {
} }
// 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置 // 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置
completionHandler(Int(UNNotificationPresentationOptions.alert.rawValue)) completionHandler(Int(UNNotificationPresentationOptions.alert.rawValue))
// 显示通知时需要刷新消息列表和消息未读总数
DispatchQueue.main.async {
// 请求消息未读总数通知
NotificationCenter.default.post(name: YhConstant.YhNotification.didRequestUnreadMsgTotalCountNotification, object: nil)
// 请求消息列表通知
NotificationCenter.default.post(name: YhConstant.YhNotification.didRequestUnreadMsgListNotification, object: nil)
}
} }
func jpushNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: (() -> Void)) { func jpushNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: (() -> Void)) {
......
...@@ -179,15 +179,15 @@ extension YHHomePageViewModel { ...@@ -179,15 +179,15 @@ extension YHHomePageViewModel {
func getList(_ firstPageFlag : Bool, _ classifyID: Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) { func getList(_ firstPageFlag : Bool, _ classifyID: Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
var params: [String : Any] = ["page": curPageIndex, var params: [String : Any] = ["page": curPageIndex,
"page_size": page_Size, "page_size": searchPageSize,
"classify_id[0]": classifyID] "classify_id[0]": classifyID]
if firstPageFlag { if firstPageFlag {
params = ["page": 1, params = ["page": 1,
"page_size": page_Size, "page_size": searchPageSize,
"classify_id[0]": classifyID] "classify_id[0]": classifyID]
} else { } else {
params = ["page": curPageIndex + 1, params = ["page": curPageIndex + 1,
"page_size": page_Size, "page_size": searchPageSize,
"classify_id[0]": classifyID] "classify_id[0]": classifyID]
} }
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Common.article let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Common.article
......
...@@ -15,9 +15,10 @@ class YHServerHKLifeViewController: YHBaseViewController { ...@@ -15,9 +15,10 @@ class YHServerHKLifeViewController: YHBaseViewController {
var tableFootView: YHServiceTableFootView! var tableFootView: YHServiceTableFootView!
var sectionView: YHServiceSectionView! var sectionView: YHServiceSectionView!
var classId: Int = 0 var classId: Int = 0
var cell: YHServerHKLifeViewCell!
var dataSouce: [YHHomeListModel?] = [] { var dataSouce: [YHHomeListModel?] = [] {
didSet { didSet {
self.homeTableView.reloadData() cell.tableFootView.items = dataSouce
} }
} }
var homeTableView: UITableView = { var homeTableView: UITableView = {
...@@ -105,7 +106,7 @@ extension YHServerHKLifeViewController { ...@@ -105,7 +106,7 @@ extension YHServerHKLifeViewController {
homeTableView.tableFooterView = tableFootView homeTableView.tableFooterView = tableFootView
homeTableView.snp.makeConstraints { make in homeTableView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview() make.top.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_TabBar) make.bottom.equalToSuperview()
} }
homeTableView.delegate = self homeTableView.delegate = self
homeTableView.dataSource = self homeTableView.dataSource = self
...@@ -159,11 +160,11 @@ extension YHServerHKLifeViewController : UITableViewDelegate,UITableViewDataSour ...@@ -159,11 +160,11 @@ extension YHServerHKLifeViewController : UITableViewDelegate,UITableViewDataSour
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell0 = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self) cell = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self)
cell0.tableFootView.items = dataSouce cell.tableFootView.items = dataSouce
cell0.tableFootView.myCollectView.es.removeRefreshFooter() cell.tableFootView.myCollectView.es.removeRefreshFooter()
cell0.selectionStyle = .none cell.selectionStyle = .none
return cell0 return cell
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......
...@@ -12,12 +12,12 @@ class YHServerNoOrderView: UIView { ...@@ -12,12 +12,12 @@ class YHServerNoOrderView: UIView {
typealias SectionBlock = (YHClassifyModel) -> () typealias SectionBlock = (YHClassifyModel) -> ()
var sectionBlock: SectionBlock? var sectionBlock: SectionBlock?
var loadMoreBlock: SectionBlock? var loadMoreBlock: SectionBlock?
var cell: YHServerHKLifeViewCell!
var tableHeadView: YHServerTableHeadView! var tableHeadView: YHServerTableHeadView!
var sectionView: YHServiceSectionView! var sectionView: YHServiceSectionView!
var dataSouce: [YHHomeListModel?] = [] { var dataSouce: [YHHomeListModel?] = [] {
didSet { didSet {
self.homeTableView.reloadData() cell.tableFootView.items = dataSouce
} }
} }
var homeTableView: UITableView = { var homeTableView: UITableView = {
...@@ -114,11 +114,11 @@ extension YHServerNoOrderView : UITableViewDelegate,UITableViewDataSource { ...@@ -114,11 +114,11 @@ extension YHServerNoOrderView : UITableViewDelegate,UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell0 = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self) cell = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self)
cell0.tableFootView.items = dataSouce cell.tableFootView.items = dataSouce
cell0.tableFootView.myCollectView.es.removeRefreshFooter() cell.tableFootView.myCollectView.es.removeRefreshFooter()
cell0.selectionStyle = .none cell.selectionStyle = .none
return cell0 return cell
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......
...@@ -37,6 +37,10 @@ class YHMessageDetailListVC: YHBaseViewController { ...@@ -37,6 +37,10 @@ class YHMessageDetailListVC: YHBaseViewController {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
YHCommonAlertView.show("清除未读", "确定要清除所有未读提示吗?", "取消", "确认") { YHCommonAlertView.show("清除未读", "确定要清除所有未读提示吗?", "取消", "确认") {
if self.msgArr.count <= 0 {
YHHUD.flash(message: "暂无消息~")
return
}
self.markAllMsgsRead() self.markAllMsgsRead()
} }
} }
...@@ -198,6 +202,7 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -198,6 +202,7 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
if 0 <= indexPath.row && indexPath.row < msgArr.count { if 0 <= indexPath.row && indexPath.row < msgArr.count {
let item = msgArr[indexPath.row] let item = msgArr[indexPath.row]
cell.updateModel(item) cell.updateModel(item)
cell.updateBottomBtn(type: self.type)
} }
return cell return cell
} }
...@@ -207,7 +212,40 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -207,7 +212,40 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.row && indexPath.row < msgArr.count {
let item = msgArr[indexPath.row]
printLog("order_id: \(item.orderId)")
if self.type == YHMessageType.infoFill.rawValue { // 资料填写
if let orderId = Int(item.orderId), orderId > 0 {
let vc = YHInformationPerfectListVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if self.type == YHMessageType.cerUpload.rawValue { // 证件上传
if let orderId = Int(item.orderId), orderId > 0 {
let vc = YHMineCertificateEntryViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if self.type == YHMessageType.draft.rawValue { // 文书定稿
if let orderId = Int(item.orderId), orderId > 0 {
let vc = YHMyDocumentsListViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if self.type == YHMessageType.fileSign.rawValue { // 文件签字
if let orderId = Int(item.orderId), orderId > 0 {
let vc = YHMySignatureListViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
}
}
} }
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
...@@ -242,10 +280,11 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -242,10 +280,11 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
// 累计出现在屏幕上的未读消息集合 // 累计出现在屏幕上的未读消息集合
func addUpAppearUnreadMessages() { func addUpAppearUnreadMessages() {
guard let visibleIndexPaths = tableView.indexPathsForVisibleRows else { return }
for indexPath in visibleIndexPaths { let visibleCells = tableView.visibleCells as! [YHDetailMessageCell]
if 0 <= indexPath.row && indexPath.row < msgArr.count { if visibleCells.count <= 0 { return }
let msgItem = msgArr[indexPath.row] for cell in visibleCells {
if let msgItem = cell.model {
if !msgItem.isRead { if !msgItem.isRead {
if !visiblemsgIdSet.contains(msgItem.id) { if !visiblemsgIdSet.contains(msgItem.id) {
visiblemsgIdSet.insert(msgItem.id) visiblemsgIdSet.insert(msgItem.id)
...@@ -254,6 +293,7 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -254,6 +293,7 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
} }
} }
} }
printLog("visiblemsgIdSet:/n \(visiblemsgIdSet)")
} }
} }
...@@ -15,11 +15,11 @@ class YHMessageListVC: YHBaseViewController { ...@@ -15,11 +15,11 @@ class YHMessageListVC: YHBaseViewController {
let model = YHMsgViewModel() let model = YHMsgViewModel()
return model return model
}() }()
var isNotifyEnabled = false
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style:.grouped)
tableView.sectionHeaderHeight = 42.0 tableView.estimatedSectionHeaderHeight = 1.0
tableView.estimatedSectionFooterHeight = 1.0 tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none tableView.separatorStyle = .none
...@@ -49,6 +49,10 @@ class YHMessageListVC: YHBaseViewController { ...@@ -49,6 +49,10 @@ class YHMessageListVC: YHBaseViewController {
bar.rightBtnClick = { bar.rightBtnClick = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
if self.msgArr.count <= 0 {
YHHUD.flash(message: "暂无消息~")
return
}
YHCommonAlertView.show("清除未读", "确定要清除所有未读提示吗?", "取消", "确认") { YHCommonAlertView.show("清除未读", "确定要清除所有未读提示吗?", "取消", "确认") {
self.markAllMsgsRead() self.markAllMsgsRead()
} }
...@@ -92,12 +96,13 @@ class YHMessageListVC: YHBaseViewController { ...@@ -92,12 +96,13 @@ class YHMessageListVC: YHBaseViewController {
super.viewWillAppear(animated) super.viewWillAppear(animated)
YHLoginManager.shared.needJumpToMsgTabFlag = false YHLoginManager.shared.needJumpToMsgTabFlag = false
getUnreadMsgList() getUnreadMsgList()
checkNotificationPermisson()
NotificationCenter.default.post(name: YhConstant.YhNotification.didRequestUnreadMsgTotalCountNotification, object: nil) NotificationCenter.default.post(name: YhConstant.YhNotification.didRequestUnreadMsgTotalCountNotification, object: nil)
} }
func setupUI() { func setupUI() {
addObservers()
gk_navigationBar.isHidden = true gk_navigationBar.isHidden = true
view.backgroundColor = .white view.backgroundColor = .white
view.addSubview(navBar) view.addSubview(navBar)
...@@ -112,22 +117,29 @@ class YHMessageListVC: YHBaseViewController { ...@@ -112,22 +117,29 @@ class YHMessageListVC: YHBaseViewController {
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar) make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-k_Height_TabBar) make.bottom.equalToSuperview().offset(-k_Height_TabBar)
} }
}
func addObservers() {
NotificationCenter.default.addObserver(self, selector: #selector(loginSuccess), name: YhConstant.YhNotification.didLoginSuccessNotifiction, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(loginSuccess), name: YhConstant.YhNotification.didLoginSuccessNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(logoutSuccess), name: YhConstant.YhNotification.didLogoutSuccessNotifiction, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(logoutSuccess), name: YhConstant.YhNotification.didLogoutSuccessNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(getUnreadMsgList), name: YhConstant.YhNotification.didRequestUnreadMsgListNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(getUnreadMsgList), name: YhConstant.YhNotification.didRequestUnreadMsgListNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(checkNotificationPermisson), name: YhConstant.YhNotification.didReqeustNotifyPermissionNotification, object: nil)
}
deinit {
NotificationCenter.default.removeObserver(self)
} }
@objc func loginSuccess() { @objc func loginSuccess() {
printLog("登录成功,进行相应的 UI刷新操作") printLog("登录成功,进行相应的 UI刷新操作")
} }
@objc func logoutSuccess() { @objc func logoutSuccess() {
} }
func getUnreadMsgList() { @objc func getUnreadMsgList() {
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 }
...@@ -182,6 +194,42 @@ class YHMessageListVC: YHBaseViewController { ...@@ -182,6 +194,42 @@ class YHMessageListVC: YHBaseViewController {
} }
} }
} }
@objc func checkNotificationPermisson() {
checkNotificationAuthorizationStatus {
[weak self] granted in
guard let self = self else { return }
DispatchQueue.main.async {
self.isNotifyEnabled = granted
self.tableView.reloadData()
}
}
}
func checkNotificationAuthorizationStatus(_ callBack:((Bool)->())?) {
UNUserNotificationCenter.current().getNotificationSettings { settings in
var enableStatus = false
switch settings.authorizationStatus {
case .authorized:
print("通知已授权")
enableStatus = true
case .denied:
print("通知被拒绝")
enableStatus = false
case .notDetermined:
print("通知权限尚未确定")
enableStatus = false
case .provisional:
print("通知以临时方式授权")
enableStatus = false
case .ephemeral:
enableStatus = false
@unknown default:
break
}
callBack?(enableStatus)
}
}
} }
extension YHMessageListVC { extension YHMessageListVC {
...@@ -202,6 +250,10 @@ extension YHMessageListVC { ...@@ -202,6 +250,10 @@ extension YHMessageListVC {
extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource { extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return msgArr.count return msgArr.count
} }
...@@ -232,7 +284,10 @@ extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -232,7 +284,10 @@ extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource {
} }
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 42.0 if !isNotifyEnabled {
return 42.0
}
return 1.0
} }
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
...@@ -246,6 +301,10 @@ extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -246,6 +301,10 @@ extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if isNotifyEnabled {
return UIView()
}
let view = UIView() let view = UIView()
view.backgroundColor = UIColor(hex: 0x3570DC, alpha: 0.06) view.backgroundColor = UIColor(hex: 0x3570DC, alpha: 0.06)
...@@ -269,10 +328,11 @@ extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -269,10 +328,11 @@ extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource {
make.right.equalTo(enableBtn.snp.left).offset(-20) make.right.equalTo(enableBtn.snp.left).offset(-20)
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
} }
enableBtn.snp.makeConstraints { make in enableBtn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: 26, height: 18)) make.size.equalTo(CGSize(width: 26, height: 42.0))
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.centerY.equalToSuperview() make.top.bottom.equalToSuperview()
} }
return view return view
} }
......
...@@ -31,6 +31,7 @@ class YHMessageInfoModel: SmartCodable { ...@@ -31,6 +31,7 @@ class YHMessageInfoModel: SmartCodable {
case unreadCount = "unread_count" case unreadCount = "unread_count"
case lastMessage = "last_message" case lastMessage = "last_message"
case lastMessageTime = "last_message_time" case lastMessageTime = "last_message_time"
case type = "type"
} }
func getTitle() -> String { func getTitle() -> String {
...@@ -62,18 +63,21 @@ class YHMsgListModel: SmartCodable { ...@@ -62,18 +63,21 @@ class YHMsgListModel: SmartCodable {
} }
class YHDetailMessageModel: SmartCodable { class YHDetailMessageModel: SmartCodable {
var id: String = "" var id: String = ""
var title: String = "" var title: String = ""
var content: String = "" var content: String = ""
var time: Int = 0 var time: Int = 0
var isRead: Bool = false var isRead: Bool = false
var orderId: Int = 0 var orderId: String = ""
required init() { required init() {
} }
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id, title, content, time
case isRead = "is_read"
case orderId = "order_id" case orderId = "order_id"
} }
} }
...@@ -21,6 +21,7 @@ class YHDetailMessageCell: UITableViewCell { ...@@ -21,6 +21,7 @@ class YHDetailMessageCell: UITableViewCell {
var bottomBtn:UIButton! var bottomBtn:UIButton!
var lineView:UIView! var lineView:UIView!
var timeLabel:UILabel! var timeLabel:UILabel!
var model:YHDetailMessageModel?
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
...@@ -32,12 +33,28 @@ class YHDetailMessageCell: UITableViewCell { ...@@ -32,12 +33,28 @@ class YHDetailMessageCell: UITableViewCell {
} }
func updateModel(_ model: YHDetailMessageModel) { func updateModel(_ model: YHDetailMessageModel) {
self.model = model
titleLabel.text = model.title titleLabel.text = model.title
detailLabel.text = model.content detailLabel.text = model.content
unreadPointView.isHidden = model.isRead unreadPointView.isHidden = model.isRead
timeLabel.text = formatTimestamp(Double(model.time)) timeLabel.text = formatTimestamp(Double(model.time))
} }
func updateBottomBtn(type:Int) {
if type == YHMessageType.infoFill.rawValue {
bottomBtn.setTitle("去填写".local, for: .normal)
} else if type == YHMessageType.cerUpload.rawValue {
bottomBtn.setTitle("去上传".local, for: .normal)
} else if type == YHMessageType.draft.rawValue {
bottomBtn.setTitle("去定稿".local, for: .normal)
} else if type == YHMessageType.fileSign.rawValue {
bottomBtn.setTitle("去签字".local, for: .normal)
}
}
func formatTimestamp(_ timestamp: TimeInterval) -> String { func formatTimestamp(_ timestamp: TimeInterval) -> String {
let currentDate = Date() let currentDate = Date()
let calendar = Calendar.current let calendar = Calendar.current
...@@ -104,6 +121,7 @@ class YHDetailMessageCell: UITableViewCell { ...@@ -104,6 +121,7 @@ class YHDetailMessageCell: UITableViewCell {
whiteView.addSubview(lineView) whiteView.addSubview(lineView)
bottomBtn = UIButton() bottomBtn = UIButton()
bottomBtn.isUserInteractionEnabled = false
bottomBtn.setTitle("去填写".local, for: .normal) bottomBtn.setTitle("去填写".local, for: .normal)
bottomBtn.setTitleColor(UIColor(hex: 0x3570DC), for: .normal) bottomBtn.setTitleColor(UIColor(hex: 0x3570DC), for: .normal)
bottomBtn.titleLabel?.font = .PFSC_R(ofSize: 14) bottomBtn.titleLabel?.font = .PFSC_R(ofSize: 14)
......
...@@ -32,6 +32,22 @@ class YHMyNotifySettingVC: YHBaseViewController { ...@@ -32,6 +32,22 @@ class YHMyNotifySettingVC: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
checkNotifyPermission()
}
func setupUI() {
gk_navTitle = "通知设置".local
view.backgroundColor = .white
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-k_Height_TabBar)
}
NotificationCenter.default.addObserver(self, selector: #selector(checkNotifyPermission), name: YhConstant.YhNotification.didReqeustNotifyPermissionNotification, object: nil)
}
@objc func checkNotifyPermission() {
checkNotificationAuthorizationStatus { checkNotificationAuthorizationStatus {
[weak self] granted in [weak self] granted in
guard let self = self else { return } guard let self = self else { return }
...@@ -46,17 +62,6 @@ class YHMyNotifySettingVC: YHBaseViewController { ...@@ -46,17 +62,6 @@ class YHMyNotifySettingVC: YHBaseViewController {
} }
} }
func setupUI() {
gk_navTitle = "通知设置".local
view.backgroundColor = .white
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-k_Height_TabBar)
}
}
func checkNotificationAuthorizationStatus(_ callBack:((Bool)->())?) { func checkNotificationAuthorizationStatus(_ callBack:((Bool)->())?) {
UNUserNotificationCenter.current().getNotificationSettings { settings in UNUserNotificationCenter.current().getNotificationSettings { settings in
var enableStatus = false var enableStatus = false
......
...@@ -137,6 +137,10 @@ class YHMyPermissionSettingVC: YHBaseViewController { ...@@ -137,6 +137,10 @@ class YHMyPermissionSettingVC: YHBaseViewController {
completion(false) completion(false)
} }
} }
deinit {
NotificationCenter.default.removeObserver(self)
}
} }
extension YHMyPermissionSettingVC: UITableViewDelegate, UITableViewDataSource { extension YHMyPermissionSettingVC: UITableViewDelegate, UITableViewDataSource {
......
...@@ -202,5 +202,11 @@ extension YhConstant { ...@@ -202,5 +202,11 @@ extension YhConstant {
// 请求消息未读总数通知 // 请求消息未读总数通知
public static let didRequestUnreadMsgTotalCountNotification = Notification.Name(rawValue: "com.yinhe.msgPage.unreadMsgTotal") public static let didRequestUnreadMsgTotalCountNotification = Notification.Name(rawValue: "com.yinhe.msgPage.unreadMsgTotal")
// 请求消息未读列表通知
public static let didRequestUnreadMsgListNotification = Notification.Name(rawValue: "com.yinhe.msgPage.unreadList")
// 请求通知权限通知
public static let didReqeustNotifyPermissionNotification = Notification.Name(rawValue: "com.yinhe.msgPage.notifyPermission")
} }
} }
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