|
@@ -8,314 +8,10 @@
|
|
|
|
|
|
import UIKit
|
|
|
import Lottie
|
|
|
-import ESTabBarController_swift
|
|
|
import PPBadgeViewSwift
|
|
|
import SwiftyMediator
|
|
|
import RongIMLib
|
|
|
|
|
|
-//class BaseTabbarViewController: NSObject {
|
|
|
-//
|
|
|
-// static let shared : BaseTabbarViewController = BaseTabbarViewController()
|
|
|
-//
|
|
|
-// var esTabBarController : ESTabBarController!
|
|
|
-//
|
|
|
-// /// 社区
|
|
|
-// var v1 : CommunityViewController!
|
|
|
-// /// 商城
|
|
|
-//// var v2 = ShoppingMallViewController!
|
|
|
-// /// 兑换专区
|
|
|
-// var v2 : BackyardViewController!
|
|
|
-// /// 发布
|
|
|
-// var v3 : BaseViewController!
|
|
|
-// /// 消息
|
|
|
-// var v4 : MessageMainViewController!
|
|
|
-//
|
|
|
-// /// 我的
|
|
|
-// var v5 : UserPersonalCenterViewController!
|
|
|
-//
|
|
|
-// /// 社区
|
|
|
-// var lottieAnimateContentView1 : BaseLottieAnimateContentView!
|
|
|
-//
|
|
|
-// /// 商城
|
|
|
-// var lottieAnimateContentView2 : BaseLottieAnimateContentView!
|
|
|
-//
|
|
|
-// /// 消息
|
|
|
-// var lottieAnimateContentView4 : BaseLottieAnimateContentView!
|
|
|
-//
|
|
|
-// /// 我的
|
|
|
-// var lottieAnimateContentView5 : BaseLottieAnimateContentView!
|
|
|
-//
|
|
|
-// var lastIndex : Int = 0
|
|
|
-//
|
|
|
-// func tabBarViewController() -> ESTabBarController {
|
|
|
-// esTabBarController = ESTabBarController()
|
|
|
-//
|
|
|
-// if #available(iOS 13.0, *) {
|
|
|
-// esTabBarController.tabBar.standardAppearance.configureWithOpaqueBackground()
|
|
|
-// esTabBarController.tabBar.standardAppearance.backgroundImage = UIImage.imageWithColor(color: UIColor.white)
|
|
|
-// esTabBarController.tabBar.standardAppearance.shadowImage = UIImage(named: "navbar_shadow_pic_down")
|
|
|
-// } else {
|
|
|
-// esTabBarController.tabBar.shadowImage = UIImage(named: "navbar_shadow_pic_down")
|
|
|
-// }
|
|
|
-//
|
|
|
-// esTabBarController.shouldHijackHandler = {
|
|
|
-// [weak self] (tabbarController, viewController, index) in
|
|
|
-// AudioServicesPlaySystemSound(1519)
|
|
|
-//
|
|
|
-// if UserModel.isTokenNil() {
|
|
|
-// if index == 2 || index == 3 || index == 4 {
|
|
|
-// return true
|
|
|
-// }else {
|
|
|
-// self?.reloadTabbar(index:index)
|
|
|
-// self?.lastIndex = index
|
|
|
-// return false
|
|
|
-// }
|
|
|
-// }else {
|
|
|
-// if index == 2 {
|
|
|
-// return true
|
|
|
-// }else {
|
|
|
-// self?.reloadTabbar(index:index)
|
|
|
-// self?.lastIndex = index
|
|
|
-// return false
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// esTabBarController.didHijackHandler = {
|
|
|
-// [weak self] tabbarController, viewController, index in
|
|
|
-// if UserModel.isTokenNil() {
|
|
|
-// kAppDelegate.setLogin()
|
|
|
-// }else {
|
|
|
-// self?.pushPublishVC()
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// /// 社区
|
|
|
-// v1 = CommunityViewController()
|
|
|
-// /// 商城
|
|
|
-// // var v2 = ShoppingMallViewController!
|
|
|
-// /// 兑换专区
|
|
|
-// v2 = BackyardViewController()
|
|
|
-// /// 发布
|
|
|
-// v3 = BaseViewController()
|
|
|
-// /// 消息
|
|
|
-// v4 = MessageMainViewController()
|
|
|
-// /// 我的
|
|
|
-// v5 = UserPersonalCenterViewController()
|
|
|
-//
|
|
|
-// /// 社区
|
|
|
-// lottieAnimateContentView1 = BaseLottieAnimateContentView(jsonStr: "communityModuleTabbar")
|
|
|
-//
|
|
|
-// /// 商城
|
|
|
-// lottieAnimateContentView2 = BaseLottieAnimateContentView(jsonStr: "shoppingMallModuleTabbar")
|
|
|
-//
|
|
|
-// /// 消息
|
|
|
-// lottieAnimateContentView4 = BaseLottieAnimateContentView(jsonStr: "messageModuleTabbar")
|
|
|
-//
|
|
|
-// /// 我的
|
|
|
-// lottieAnimateContentView5 = BaseLottieAnimateContentView(jsonStr: "MineModuleTabbar")
|
|
|
-//
|
|
|
-//// v1.tabBarItem = ESTabBarItem.init(lottieAnimateContentView1, title: "社区", image: UIImage(named: "tabbar_home")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage: nil)
|
|
|
-//// v2.tabBarItem = ESTabBarItem.init(lottieAnimateContentView2, title: "福利", image: UIImage(named: "tabbar_shopping")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage: nil)
|
|
|
-//
|
|
|
-// tabBarItemStyle(navc: v1, normalImg: "tabbar_home", selectorImg: "tabbar_home_pre", title: "社区")
|
|
|
-// tabBarItemStyle(navc: v2, normalImg: "tabbar_shopping", selectorImg: "tabbar_shopping_pre", title: "后院")
|
|
|
-// v3.tabBarItem = UITabBarItem(title: nil, image: UIImage(named: "tabbar_publish")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage: UIImage(named: "tabbar_publish")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal))
|
|
|
-// v3.tabBarItem.imageInsets = UIEdgeInsets(top: 4, left: 0, bottom: -4, right: 0);
|
|
|
-// tabBarItemStyle(navc: v4, normalImg: "tabbar_massage", selectorImg: "tabbar_massage_pre", title: "消息")
|
|
|
-// tabBarItemStyle(navc: v5, normalImg: "tabbar_my", selectorImg: "tabbar_my_pre", title: "我的")
|
|
|
-//
|
|
|
-//// if UserModel.isTokenNil() {
|
|
|
-//// setLoginOutTabBarItem()
|
|
|
-//// }else {
|
|
|
-//// setLoginTabBarItem()
|
|
|
-//// }
|
|
|
-//
|
|
|
-// let n1 = BaseNavigationViewController.init(rootViewController: v1)
|
|
|
-// let n2 = BaseNavigationViewController.init(rootViewController: v2)
|
|
|
-// let n3 = BaseNavigationViewController.init(rootViewController: v3)
|
|
|
-// let n4 = BaseNavigationViewController.init(rootViewController: v4)
|
|
|
-// let n5 = BaseNavigationViewController.init(rootViewController: v5)
|
|
|
-//
|
|
|
-// esTabBarController.viewControllers = [n1, n2, n3, n4, n5]
|
|
|
-// //将要进入前台的时候
|
|
|
-// setBadge()
|
|
|
-// NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main, using: {
|
|
|
-// [weak self] (notification) in
|
|
|
-// if !UserModel.isTokenNil() {
|
|
|
-// //获取消息的小红点
|
|
|
-// MessageModuleManager.shared.userMemberMessageIndexApi()
|
|
|
-// self?.setBadge()
|
|
|
-// }
|
|
|
-//
|
|
|
-// })
|
|
|
-// //监听消息
|
|
|
-// NotificationCenter.default.addObserver(forName: NSNotification.Name("MessageMainViewController"), object: nil, queue: OperationQueue.main) {
|
|
|
-// [weak self] notification in
|
|
|
-// self?.setBadge()
|
|
|
-// }
|
|
|
-// return esTabBarController
|
|
|
-// }
|
|
|
-//
|
|
|
-// func setLoginTabBarItem() {
|
|
|
-//// v4.tabBarItem = ESTabBarItem.init(lottieAnimateContentView4, title: "消息", image: UIImage(named: "tabbar_massage")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage: nil)
|
|
|
-//// v5.tabBarItem = ESTabBarItem.init(lottieAnimateContentView5, title: "我的", image: UIImage(named: "tabbar_my")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage: nil)
|
|
|
-// tabBarItemStyle(navc: v1, normalImg: "tabbar_home", selectorImg: "tabbar_home_pre", title: "社区")
|
|
|
-// tabBarItemStyle(navc: v2, normalImg: "tabbar_shopping", selectorImg: "tabbar_shopping_pre", title: "后院")
|
|
|
-// v3.tabBarItem = UITabBarItem(title: nil, image: UIImage(named: "tabbar_publish")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage: UIImage(named: "tabbar_publish")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal))
|
|
|
-// v3.tabBarItem.imageInsets = UIEdgeInsets(top: 4, left: 0, bottom: -4, right: 0);
|
|
|
-// tabBarItemStyle(navc: v4, normalImg: "tabbar_massage", selectorImg: "tabbar_massage_pre", title: "消息")
|
|
|
-// tabBarItemStyle(navc: v5, normalImg: "tabbar_my", selectorImg: "tabbar_my_pre", title: "我的")
|
|
|
-// }
|
|
|
-//
|
|
|
-// func setLoginOutTabBarItem() {
|
|
|
-//// v4.tabBarItem = ESTabBarItem.init(BaseTabBarItemContentView(), title: "消息", image: UIImage(named: "tabbar_massage")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage:nil)
|
|
|
-//// v5.tabBarItem = ESTabBarItem.init(BaseTabBarItemContentView(), title: "我的", image: UIImage(named: "tabbar_my")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage:nil)
|
|
|
-// tabBarItemStyle(navc: v1, normalImg: "tabbar_home", selectorImg: "tabbar_home_pre", title: "社区")
|
|
|
-// tabBarItemStyle(navc: v2, normalImg: "tabbar_shopping", selectorImg: "tabbar_shopping_pre", title: "后院")
|
|
|
-// v3.tabBarItem = UITabBarItem(title: nil, image: UIImage(named: "tabbar_publish")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage: UIImage(named: "tabbar_publish")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal))
|
|
|
-// v3.tabBarItem.imageInsets = UIEdgeInsets(top: 4, left: 0, bottom: -4, right: 0);
|
|
|
-// tabBarItemStyle(navc: v4, normalImg: "tabbar_massage", selectorImg: "tabbar_massage_pre", title: "消息")
|
|
|
-// tabBarItemStyle(navc: v5, normalImg: "tabbar_my", selectorImg: "tabbar_my_pre", title: "我的")
|
|
|
-// }
|
|
|
-//
|
|
|
-// /// 跳转到VC
|
|
|
-// func pushPublishVC() {
|
|
|
-//
|
|
|
-// if !AliyunVodUpToyoPublishManager.shared.isUploading { // 是否正在上传中
|
|
|
-// PublishNewPopView.show(imageStrs: ["publish_btn_picture","publish_btn_video","publish_btn_photo","publish_btn_article"], titles: ["相册","视频","拍照","文章"], columnCount: 4) { (index) in
|
|
|
-// if index != 3 {
|
|
|
-// let pickVc = PublishViewController()
|
|
|
-// pickVc.index = index
|
|
|
-//// let pickVc = PublishNewViewController()
|
|
|
-//// pickVc.index = index
|
|
|
-// let nav = BaseNavigationViewController.init(rootViewController: pickVc)
|
|
|
-// nav.modalPresentationStyle = .fullScreen
|
|
|
-// BaseTabbarViewController.shared.esTabBarController.present(nav, animated: true, completion: nil)
|
|
|
-// }else {
|
|
|
-// Mediator.push(H5RouterModuleType.pushPostArticle)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// SwiftProgressHUD.shared().showText("内容上传中,请稍等", textAlignment: .center)
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 设置Badge
|
|
|
-// func setBadge() {
|
|
|
-// if UserModel.isTokenNil() {
|
|
|
-// v4.tabBarItem.pp.hiddenBadge()
|
|
|
-// v5.tabBarItem.pp.hiddenBadge()
|
|
|
-// }else {
|
|
|
-// //消息
|
|
|
-// let messageIndexModel = MessageIndexModel.shared.object()
|
|
|
-// if messageIndexModel?.activity?.isYes == 1 || messageIndexModel?.follow?.isYes == 1 || messageIndexModel?.notification?.isYes == 1 || messageIndexModel?.praise?.isYes == 1 || messageIndexModel?.comment?.isYes == 1 || (RCIMClient.shared()?.getTotalUnreadCount())! > Int32(0) {
|
|
|
-// v4.tabBarItem.pp.addDot(color:kFE352BColor)
|
|
|
-// v4.tabBarItem.pp.moveBadge(x: -3,y: 3)
|
|
|
-//
|
|
|
-// // let tabBarItem = v4.tabBarItem as? ESTabBarItem
|
|
|
-// // tabBarItem?.contentView?.badgeColor = kFE352BColor
|
|
|
-// // tabBarItem?.contentView?.badgeValue = ""
|
|
|
-// // tabBarItem?.contentView?.badgeOffset = UIOffset(horizontal: 0, vertical: -22)
|
|
|
-// }else {
|
|
|
-// // let tabBarItem = v4.tabBarItem as? ESTabBarItem
|
|
|
-// // tabBarItem?.contentView?.badgeValue = nil
|
|
|
-// v4.tabBarItem.pp.hiddenBadge()
|
|
|
-// }
|
|
|
-//
|
|
|
-// //我的
|
|
|
-// if UpdateVersionModel.shared.object()?.upGradeModelType == .update || UpdateVersionModel.shared.object()?.upGradeModelType == .strongUpdate {
|
|
|
-//
|
|
|
-// // let tabBarItem = v5.tabBarItem as? ESTabBarItem
|
|
|
-// // tabBarItem?.contentView?.badgeColor = kFE352BColor
|
|
|
-// // tabBarItem?.contentView?.badgeValue = ""
|
|
|
-// // tabBarItem?.contentView?.badgeOffset = UIOffset(horizontal: 0, vertical: -22)
|
|
|
-// v5.tabBarItem.pp.addDot(color:kFE352BColor)
|
|
|
-// v5.tabBarItem.pp.moveBadge(x: -3,y: 3)
|
|
|
-// }else {
|
|
|
-// // let tabBarItem = v5.tabBarItem as? ESTabBarItem
|
|
|
-// // tabBarItem?.contentView?.badgeValue = nil
|
|
|
-// v5.tabBarItem.pp.hiddenBadge()
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// func reloadTabbar(index:Int) {
|
|
|
-//
|
|
|
-// if index == 0 && lastIndex == 0 {
|
|
|
-//// self.lottieAnimateContentView1.animationView.stop()
|
|
|
-//// self.lottieAnimateContentView1.animationView.play()
|
|
|
-//
|
|
|
-// if communityModuleTopType == .communityModuleFollowTop {
|
|
|
-// NotificationCenter.default.post(name: NSNotification.Name("CommunityModuleFollowTop"), object: nil)
|
|
|
-//
|
|
|
-// }
|
|
|
-// if communityModuleTopType == .communityModuleRecommendTop {
|
|
|
-// NotificationCenter.default.post(name: NSNotification.Name("CommunityModuleRecommendTop"), object: nil)
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-// if index == 1 && lastIndex == 1 {
|
|
|
-//// self.lottieAnimateContentView2.animationView.stop()
|
|
|
-//// self.lottieAnimateContentView2.animationView.play()
|
|
|
-// NotificationCenter.default.post(name: NSNotification.Name("BackyardViewModuleTop"), object: nil)
|
|
|
-//
|
|
|
-// }
|
|
|
-// if index == 3 && lastIndex == 3 {
|
|
|
-//// self.lottieAnimateContentView4.animationView.stop()
|
|
|
-//// self.lottieAnimateContentView4.animationView.play()
|
|
|
-// NotificationCenter.default.post(name: NSNotification.Name("MessageModuleTop"), object: nil)
|
|
|
-//
|
|
|
-// }
|
|
|
-// if index == 4 && lastIndex == 4 {
|
|
|
-//// self.lottieAnimateContentView5.animationView.stop()
|
|
|
-//// self.lottieAnimateContentView5.animationView.play()
|
|
|
-// NotificationCenter.default.post(name: NSNotification.Name("MineModuleTop"), object: nil)
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// private func tabBarItemStyle(navc : BaseViewController, normalImg : String, selectorImg : String, title : String){
|
|
|
-// navc.tabBarItem = UITabBarItem.init(title: title, image: UIImage(named:normalImg), selectedImage: UIImage(named:selectorImg))
|
|
|
-// navc.tabBarItem.setTitleTextAttributes([NSAttributedString.Key.foregroundColor:k333333Color], for: UIControl.State.normal)
|
|
|
-// navc.tabBarItem.setTitleTextAttributes([NSAttributedString.Key.foregroundColor:k333333Color], for: UIControl.State.selected)
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-//}
|
|
|
-//
|
|
|
-//extension ESTabBar {
|
|
|
-// open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
|
|
-//
|
|
|
-// let view = super.hitTest(point, with: event)
|
|
|
-// if view == nil {
|
|
|
-// if UserModel.isTokenNil() && LoginNowView.shared.loginNowView != nil
|
|
|
-// && !(UIViewController.topMost is BrowsePicturesViewController)
|
|
|
-// && !(UIViewController.topMost is H5CommonViewController)
|
|
|
-// && !(UIViewController.topMost is CommunityFeaturedTopicsViewController) {
|
|
|
-// for subView in subviews {
|
|
|
-// if !subView.subviews.isEmpty {
|
|
|
-// for subView in subView.subviews {
|
|
|
-// let myPoint = subView.convert(point, from: self)
|
|
|
-// if subView.bounds.contains(myPoint) {
|
|
|
-// return subView
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// let myPoint = subView.convert(point, from: self)
|
|
|
-// if subView.bounds.contains(myPoint) {
|
|
|
-// return subView
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return view
|
|
|
-// }
|
|
|
-//}
|
|
|
-
|
|
|
-
|
|
|
class BaseTabbarViewController: UITabBarController {
|
|
|
|
|
|
static let shared : BaseTabbarViewController = BaseTabbarViewController()
|