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

// 消息

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