Commit ef31e6a1 authored by Steven杜宇's avatar Steven杜宇

// 消息

parent 1dfb8bfa
...@@ -73,8 +73,11 @@ extension YHTabBarViewController { ...@@ -73,8 +73,11 @@ extension YHTabBarViewController {
DispatchQueue.main.async { DispatchQueue.main.async {
if let vcs = self.viewControllers, let msgListVC = vcs[safe: 2] { if let vcs = self.viewControllers, let msgListVC = vcs[safe: 2] {
let count = self.viewModel.unreadTotalCount let count = self.viewModel.unreadTotalCount
var unreadText = String(count) var unreadText:String? = nil
if count > 99 { if 0 < count && count <= 99 {
unreadText = String(count)
} else if count > 99 {
unreadText = "99+" unreadText = "99+"
} }
msgListVC.tabBarItem.badgeValue = unreadText msgListVC.tabBarItem.badgeValue = unreadText
......
...@@ -221,7 +221,9 @@ extension YHHomePageViewController : UITabBarControllerDelegate { ...@@ -221,7 +221,9 @@ extension YHHomePageViewController : UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
let index = tabBarController.viewControllers?.firstIndex(of: viewController) guard let index = tabBarController.viewControllers?.firstIndex(of: viewController) else {
return false
}
if index == 1 || index == 2 { if index == 1 || index == 2 {
if YHLoginManager.shared.isLogin() { if YHLoginManager.shared.isLogin() {
return true return true
...@@ -231,7 +233,7 @@ extension YHHomePageViewController : UITabBarControllerDelegate { ...@@ -231,7 +233,7 @@ extension YHHomePageViewController : UITabBarControllerDelegate {
UIViewController.current?.navigationController?.present(vc, animated: true) UIViewController.current?.navigationController?.present(vc, animated: true)
YHLoginManager.shared.loginSuccessActionBlock = {[weak self] in YHLoginManager.shared.loginSuccessActionBlock = {[weak self] in
guard let self = self else { return } guard let self = self else { return }
tabBarController.selectedIndex = 1 tabBarController.selectedIndex = index
YHLoginManager.shared.loginSuccessActionBlock = nil YHLoginManager.shared.loginSuccessActionBlock = nil
} }
return false return false
......
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