Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
bc801dc6
Commit
bc801dc6
authored
Apr 18, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
fb476550
' into xiezhaolin
parents
cc9b5d29
fb476550
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
215 additions
and
52 deletions
+215
-52
Applegate(JPush).swift
galaxy/galaxy/Applegate(JPush).swift
+12
-5
YHHomePageViewController.swift
...Classes/Modules/Home(首页)/C/YHHomePageViewController.swift
+32
-17
YHHomeListModel.swift
...y/galaxy/Classes/Modules/Home(首页)/M/YHHomeListModel.swift
+2
-0
YHHomeBannerCollectionViewCell.swift
...s/Modules/Home(首页)/V/YHHomeBannerCollectionViewCell.swift
+3
-2
YHCustomNavigationBar.swift
...(服务中心)/MyCertificates(我的证书)/V/YHCustomNavigationBar.swift
+1
-0
YHMessageDetailListVC.swift
...Classes/Modules/Message(消息)/C/YHMessageDetailListVC.swift
+45
-5
YHMessageListVC.swift
...alaxy/Classes/Modules/Message(消息)/C/YHMessageListVC.swift
+71
-11
YHMsgListModel.swift
...galaxy/Classes/Modules/Message(消息)/M/YHMsgListModel.swift
+5
-1
YHDetailMessageCell.swift
...y/Classes/Modules/Message(消息)/V/YHDetailMessageCell.swift
+18
-0
YHMyNotifySettingVC.swift
...laxy/Classes/Modules/Mine(我的)/C/YHMyNotifySettingVC.swift
+16
-11
YHMyPermissionSettingVC.swift
.../Classes/Modules/Mine(我的)/C/YHMyPermissionSettingVC.swift
+4
-0
YhConstant.swift
galaxy/galaxy/Classes/Tools/Helper/YhConstant.swift
+6
-0
No files found.
galaxy/galaxy/Applegate(JPush).swift
View file @
bc801dc6
...
@@ -62,11 +62,11 @@ extension AppDelegate: JPUSHRegisterDelegate {
...
@@ -62,11 +62,11 @@ extension AppDelegate: JPUSHRegisterDelegate {
}
}
//后台进前台
//后台进前台
func
application
DidEnterBack
ground
(
_
application
:
UIApplication
)
{
func
application
WillEnterFore
ground
(
_
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
))
{
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomePageViewController.swift
View file @
bc801dc6
...
@@ -55,9 +55,8 @@ class YHHomePageViewController: YHBaseViewController {
...
@@ -55,9 +55,8 @@ class YHHomePageViewController: YHBaseViewController {
return
view
return
view
}()
}()
var
tapTimestamp
:
CFAbsoluteTime
=
-
10.0
var
tapTimestamp
:
CFAbsoluteTime
=
-
10.0
}
}
private
extension
YHHomePageViewController
{
private
extension
YHHomePageViewController
{
...
@@ -68,24 +67,31 @@ private extension YHHomePageViewController {
...
@@ -68,24 +67,31 @@ private extension YHHomePageViewController {
func
getData
()
{
func
getData
()
{
self
.
homeHeaderView
.
homeBannerView
.
dataArr
=
[
YHBannerModel
.
localDefaultItem
()]
self
.
homeHeaderView
.
homeBannerView
.
dataArr
=
[
YHBannerModel
.
localDefaultItem
()]
loadFirstData
()
DispatchQueue
.
global
()
.
async
{
self
.
loadFirstData
()
viewModel
.
getHomeBanner
(
0
)
{[
weak
self
]
success
,
error
in
self
.
viewModel
.
getHomeBanner
(
0
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
homeHeaderView
.
homeBannerView
.
dataArr
=
self
.
viewModel
.
banners
??
[
YHBannerModel
.
localDefaultItem
()]
DispatchQueue
.
main
.
async
{
self
.
homeHeaderView
.
homeBannerView
.
dataArr
=
self
.
viewModel
.
banners
??
[
YHBannerModel
.
localDefaultItem
()]
}
}
}
}
}
}
func
loadMoreData
()
{
func
loadMoreData
()
{
viewModel
.
getHomeNewsList
(
firstPageFlag
:
false
)
{[
weak
self
]
success
,
error
in
viewModel
.
getHomeNewsList
(
firstPageFlag
:
false
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
homeCollectView
.
es
.
stopLoadingMore
()
DispatchQueue
.
main
.
asyncAfter
(
wallDeadline
:
.
now
()
+
0.35
,
execute
:
{
CATransaction
.
setDisableActions
(
true
)
if
self
.
viewModel
.
hasMoreForHomeNews
==
false
{
self
.
homeCollectView
.
reloadData
()
homeCollectView
.
es
.
noticeNoMoreData
()
CATransaction
.
commit
()
}
self
.
homeCollectView
.
reloadItems
(
at
:
[
IndexPath
(
index
:
0
)])
self
.
homeCollectView
.
es
.
stopLoadingMore
()
if
self
.
viewModel
.
hasMoreForHomeNews
==
false
{
self
.
homeCollectView
.
es
.
noticeNoMoreData
()
}
})
}
}
}
}
...
@@ -93,11 +99,18 @@ private extension YHHomePageViewController {
...
@@ -93,11 +99,18 @@ private extension YHHomePageViewController {
viewModel
.
getHomeNewsList
(
firstPageFlag
:
true
)
{[
weak
self
]
success
,
error
in
viewModel
.
getHomeNewsList
(
firstPageFlag
:
true
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
homeCollectView
.
es
.
stopPullToRefresh
()
homeCollectView
.
es
.
stopPullToRefresh
()
if
self
.
viewModel
.
hasMoreForHomeNews
==
false
{
if
self
.
viewModel
.
hasMoreForHomeNews
==
false
{
homeCollectView
.
es
.
noticeNoMoreData
()
homeCollectView
.
es
.
noticeNoMoreData
()
}
}
self
.
homeCollectView
.
reloadItems
(
at
:
[
IndexPath
(
index
:
0
)])
DispatchQueue
.
main
.
async
{
CATransaction
.
setDisableActions
(
true
)
self
.
homeCollectView
.
reloadData
()
CATransaction
.
commit
()
}
}
}
}
}
...
@@ -136,6 +149,8 @@ private extension YHHomePageViewController {
...
@@ -136,6 +149,8 @@ private extension YHHomePageViewController {
r
.
origin
.
y
=
r
.
origin
.
y
-
YHHomeHeadView
.
viewH
r
.
origin
.
y
=
r
.
origin
.
y
-
YHHomeHeadView
.
viewH
tmpHeadView
.
frame
=
r
tmpHeadView
.
frame
=
r
homeCollectView
.
showsHorizontalScrollIndicator
=
false
homeCollectView
.
showsVerticalScrollIndicator
=
false
homeCollectView
.
es
.
addInfiniteScrolling
{
homeCollectView
.
es
.
addInfiniteScrolling
{
self
.
loadMoreData
()
self
.
loadMoreData
()
}
}
...
@@ -218,7 +233,7 @@ extension YHHomePageViewController : UITabBarControllerDelegate {
...
@@ -218,7 +233,7 @@ extension YHHomePageViewController : UITabBarControllerDelegate {
UIApplication
.
shared
.
applicationIconBadgeNumber
=
0
UIApplication
.
shared
.
applicationIconBadgeNumber
=
0
}
}
}
}
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
shouldSelect
viewController
:
UIViewController
)
->
Bool
{
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
shouldSelect
viewController
:
UIViewController
)
->
Bool
{
guard
let
index
=
tabBarController
.
viewControllers
?
.
firstIndex
(
of
:
viewController
)
else
{
guard
let
index
=
tabBarController
.
viewControllers
?
.
firstIndex
(
of
:
viewController
)
else
{
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/M/YHHomeListModel.swift
View file @
bc801dc6
...
@@ -71,6 +71,8 @@ class YHHomeListModel: YHBaseModel {
...
@@ -71,6 +71,8 @@ class YHHomeListModel: YHBaseModel {
imageHeight
=
width
*
imageSize
.
height
/
imageSize
.
width
imageHeight
=
width
*
imageSize
.
height
/
imageSize
.
width
if
imageHeight
>
280
{
if
imageHeight
>
280
{
imageHeight
=
280
imageHeight
=
280
}
else
if
imageHeight
<
140
{
imageHeight
=
140
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeBannerCollectionViewCell.swift
View file @
bc801dc6
...
@@ -27,6 +27,7 @@ class YHHomeBannerCollectionViewCell: FSPagerViewCell {
...
@@ -27,6 +27,7 @@ class YHHomeBannerCollectionViewCell: FSPagerViewCell {
let
imagV
:
UIImageView
=
UIImageView
()
let
imagV
:
UIImageView
=
UIImageView
()
imagV
.
contentMode
=
.
scaleAspectFill
imagV
.
contentMode
=
.
scaleAspectFill
imagV
.
clipsToBounds
=
true
imagV
.
clipsToBounds
=
true
imagV
.
image
=
UIImage
(
named
:
"global_default_image"
)
return
imagV
return
imagV
}()
}()
...
@@ -86,9 +87,9 @@ private extension YHHomeBannerCollectionViewCell {
...
@@ -86,9 +87,9 @@ private extension YHHomeBannerCollectionViewCell {
effectV
.
isHidden
=
false
effectV
.
isHidden
=
false
if
let
url
=
URL
(
string
:
model
.
img_url
)
{
if
let
url
=
URL
(
string
:
model
.
img_url
)
{
// bannerImagV.kf.setImage(with: url)
bannerImagV
.
kf
.
setImage
(
with
:
url
,
placeholder
:
UIImage
(
named
:
"global_default_image"
))
bannerImagV
.
kf
.
setImage
(
with
:
url
,
placeholder
:
UIImage
(
named
:
"global_default_image"
))
}
else
{
bannerImagV
.
image
=
UIImage
(
named
:
"global_default_image"
)
}
}
bannerTitleLable
.
text
=
model
.
name
bannerTitleLable
.
text
=
model
.
name
}
}
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/V/YHCustomNavigationBar.swift
View file @
bc801dc6
...
@@ -56,6 +56,7 @@ class YHCustomNavigationBar: UIView {
...
@@ -56,6 +56,7 @@ class YHCustomNavigationBar: UIView {
private
lazy
var
rightButton
:
UIButton
=
{
private
lazy
var
rightButton
:
UIButton
=
{
let
btn
=
UIButton
()
let
btn
=
UIButton
()
btn
.
YH_clickEdgeInsets
=
UIEdgeInsets
(
top
:
20
,
left
:
20
,
bottom
:
20
,
right
:
20
)
btn
.
addTarget
(
self
,
action
:
#selector(
didRightButtonClicked
)
,
for
:
.
touchUpInside
)
btn
.
addTarget
(
self
,
action
:
#selector(
didRightButtonClicked
)
,
for
:
.
touchUpInside
)
return
btn
return
btn
}()
}()
...
...
galaxy/galaxy/Classes/Modules/Message(消息)/C/YHMessageDetailListVC.swift
View file @
bc801dc6
...
@@ -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
)
"
)
}
}
}
}
galaxy/galaxy/Classes/Modules/Message(消息)/C/YHMessageListVC.swift
View file @
bc801dc6
...
@@ -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
}
}
...
...
galaxy/galaxy/Classes/Modules/Message(消息)/M/YHMsgListModel.swift
View file @
bc801dc6
...
@@ -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"
}
}
}
}
galaxy/galaxy/Classes/Modules/Message(消息)/V/YHDetailMessageCell.swift
View file @
bc801dc6
...
@@ -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
)
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMyNotifySettingVC.swift
View file @
bc801dc6
...
@@ -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
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMyPermissionSettingVC.swift
View file @
bc801dc6
...
@@ -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
{
...
...
galaxy/galaxy/Classes/Tools/Helper/YhConstant.swift
View file @
bc801dc6
...
@@ -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"
)
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment