南鑫林 il y a 5 ans
Parent
commit
17b52adfc5

+ 9 - 9
RainbowPlanet/Podfile

@@ -39,8 +39,8 @@ target 'RainbowPlanet' do
   # 占位图
   pod 'LYEmptyView'
   # 分段导航栏
-  pod 'JXSegmentedView', '1.0.0'
-  pod 'JXPagingView/Paging', '1.1.18'
+  pod 'JXSegmentedView'
+  pod 'JXPagingView/Paging'
   # 轮播
   pod 'FSPagerView'
   # 小红点
@@ -63,10 +63,10 @@ target 'RainbowPlanet' do
   pod 'PGDatePicker'
   # 生成二维码
   pod 'EFQRCode'
-  
+
   # Label扩展
   pod 'YYText'
-  
+
   pod 'AFNetworking', '~> 3.0'
   pod 'JSONModel','~> 1.7.0'
   pod 'ZipArchive','1.4.0'
@@ -75,8 +75,8 @@ target 'RainbowPlanet' do
   # 内存泄露
   #  pod 'MLeaksFinder'
   #  pod 'FBMemoryProfiler'
-  
-  
+
+
   #======================第三方平台===========
   #======================友盟===========
   # UM基础库
@@ -96,13 +96,13 @@ target 'RainbowPlanet' do
   pod 'UMCShare/Social/ReducedQQ'
   # 集成新浪微博(精简版1M)
   pod 'UMCShare/Social/ReducedSina'
-  
+
   #=====================百度地图===========
   # 百度地图定位SDK
   pod 'BMKLocationKit', '1.5.0'
   # 百度地图SDK
   pod 'BaiduMapKit'
-  
+
   #=====================AliyunVideoSDK===========
   #共同依赖的库
   pod 'QuCore-ThirdParty'
@@ -113,7 +113,7 @@ target 'RainbowPlanet' do
   #播放器SDK
    pod 'AliPlayerPartSDK_iOS'
   #    pod 'AliPlayerSDK_iOS' #单独集成播放器时使用这个
-  
+
   #=====================融云IMSDK===========
   #融云 IM 通讯能力库
   pod 'RongCloudIM/IMLib'

+ 7 - 7
RainbowPlanet/Podfile.lock

@@ -48,8 +48,8 @@ PODS:
   - InputBarAccessoryView/Core (4.3.1)
   - IQKeyboardManagerSwift (6.5.2)
   - JSONModel (1.7.0)
-  - JXPagingView/Paging (1.1.18)
-  - JXSegmentedView (1.0.0)
+  - JXPagingView/Paging (1.1.19)
+  - JXSegmentedView (1.0.2)
   - KeychainAccess (4.1.0)
   - Kingfisher (5.7.1)
   - lottie-ios (3.1.5)
@@ -127,8 +127,8 @@ DEPENDENCIES:
   - InputBarAccessoryView
   - IQKeyboardManagerSwift
   - JSONModel (~> 1.7.0)
-  - JXPagingView/Paging (= 1.1.18)
-  - JXSegmentedView (= 1.0.0)
+  - JXPagingView/Paging
+  - JXSegmentedView
   - KeychainAccess
   - Kingfisher (~> 5.7.1)
   - lottie-ios
@@ -238,8 +238,8 @@ SPEC CHECKSUMS:
   InputBarAccessoryView: 58a348be7ea2736c7eec60e5c315511c2dbb39fd
   IQKeyboardManagerSwift: c75366f1f19590e8caeae45fcd5815c9289d6099
   JSONModel: 840bc0fcffb24b8454d2c026bf26fea454b8e98d
-  JXPagingView: 34bc70f962404e1a0b092ef643e5ccf6882119b2
-  JXSegmentedView: 257773dde0c65f86c9d873c5cf93d15c76e170cc
+  JXPagingView: d28c0e245b850cdb47e3f04c07d8c35e30c18531
+  JXSegmentedView: 2988fe07060a9b91b0112eabd6dee0df0cbca8b3
   KeychainAccess: 445e28864fe6d3458b41fa211bcdc39890e8bd5a
   Kingfisher: 176d377ad339113c99ad4980cbae687f807e20fe
   lottie-ios: 32bf84389337d86fbc8b12266e88452e0abf1dee
@@ -271,6 +271,6 @@ SPEC CHECKSUMS:
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: d64cb4bc33c8115a6e4011949628e85da090a924
+PODFILE CHECKSUM: f0a02f9818b61369c9e3279cb7c7cc3979ac8e3c
 
 COCOAPODS: 1.8.4

+ 4 - 4
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -6121,8 +6121,8 @@
 				A77F2C5A2231FB49001BD3F6 /* Frameworks */,
 				A77F2C5B2231FB49001BD3F6 /* Resources */,
 				A74D9D5F2327B54100F05C14 /* Embed App Extensions */,
-				95ACAEC80CC4F909AD2D6F4A /* [CP] Embed Pods Frameworks */,
-				B44DBEB9B9F5EE1308FF8647 /* [CP] Copy Pods Resources */,
+				4BAE8F1C0261EFD89B7C6205 /* [CP] Embed Pods Frameworks */,
+				C50BFE7850FCD104573727C9 /* [CP] Copy Pods Resources */,
 			);
 			buildRules = (
 			);
@@ -6304,7 +6304,7 @@
 /* End PBXResourcesBuildPhase section */
 
 /* Begin PBXShellScriptBuildPhase section */
-		95ACAEC80CC4F909AD2D6F4A /* [CP] Embed Pods Frameworks */ = {
+		4BAE8F1C0261EFD89B7C6205 /* [CP] Embed Pods Frameworks */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
@@ -6321,7 +6321,7 @@
 			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RainbowPlanet/Pods-RainbowPlanet-frameworks.sh\"\n";
 			showEnvVarsInLog = 0;
 		};
-		B44DBEB9B9F5EE1308FF8647 /* [CP] Copy Pods Resources */ = {
+		C50BFE7850FCD104573727C9 /* [CP] Copy Pods Resources */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (

+ 5 - 1
RainbowPlanet/RainbowPlanet.xcodeproj/xcshareddata/xcschemes/RainbowPlanet.xcscheme

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
    LastUpgradeVersion = "1120"
-   version = "1.3">
+   version = "1.7">
    <BuildAction
       parallelizeBuildables = "YES"
       buildImplicitDependencies = "YES">
@@ -87,6 +87,10 @@
             isEnabled = "YES">
          </EnvironmentVariable>
       </EnvironmentVariables>
+      <LocationScenarioReference
+         identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
+         referenceType = "1">
+      </LocationScenarioReference>
    </LaunchAction>
    <ProfileAction
       buildConfiguration = "Release"

+ 5 - 5
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift

@@ -57,7 +57,7 @@ extension AppDelegate {
             if(UserModel.shared().getModel()?.isFollowSuggestTopic == 0 || UserModel.shared().getModel()?.isFollowSuggestTopic == nil ) {//设置性别话题
                 setNoLoginOut()
             }else {
-                window?.rootViewController = BaseTabbarViewController.shared.tabBarViewController()
+                window?.rootViewController = BaseTabbarViewController.shared
                 setData()
             }
         }else {// 进入首页
@@ -81,7 +81,7 @@ extension AppDelegate {
         // 移除快递信息
         DeliveryMethodTypeModel.shared().removeLoginModel()
         // 设置tabBar
-        self.window?.rootViewController = BaseTabbarViewController.shared.tabBarViewController()
+        self.window?.rootViewController = BaseTabbarViewController.shared
         //添加登录view
         LoginNowView.initLoginNowView()
     }
@@ -96,7 +96,7 @@ extension AppDelegate {
         BaseTabbarViewController.shared.setBadge()
         //添加登录view
         LoginNowView.initLoginNowView()
-        BaseTabbarViewController.shared.esTabBarController.selectedIndex = 0
+        BaseTabbarViewController.shared.selectedIndex = 0
         // 退出登录
         NotificationCenter.default.post(name: NSNotification.Name("loginOut"), object: nil)
     }
@@ -158,8 +158,8 @@ extension AppDelegate {
 //        NXLPermission.request(NXLPermissionType.locationAlwaysAndWhenInUse) {}
 //        NXLPermission.request(NXLPermissionType.notification) {}
         NXLPermission.request(NXLPermissionType.photoLibrary) {}
-        NXLPermission.request(NXLPermissionType.camera) {}
-        NXLPermission.request(NXLPermissionType.microphone) {}
+//        NXLPermission.request(NXLPermissionType.camera) {}
+//        NXLPermission.request(NXLPermissionType.microphone) {}
     }
     
 }

+ 2 - 0
RainbowPlanet/RainbowPlanet/Base/BaseNavigationController/BaseNavigationViewController.swift

@@ -23,5 +23,7 @@ class BaseNavigationViewController: UINavigationController {
         }
         super.pushViewController(viewController, animated: animated)
     }
+    
+    
 
 }

+ 366 - 151
RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift

@@ -13,89 +13,339 @@ import PPBadgeViewSwift
 import SwiftyMediator
 import RongIMLib
 
-class BaseTabbarViewController: NSObject {
+//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
+//    }
+//}
 
-    static let shared : BaseTabbarViewController = BaseTabbarViewController()
-    
-    var esTabBarController : ESTabBarController!
+
+class BaseTabbarViewController: UITabBarController {
     
+    static let shared : BaseTabbarViewController = BaseTabbarViewController()
     /// 社区
     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!
-    
+    /// 选中的selected
+    var customSelectedIndex : Int = 0
     var lastIndex : Int = 0
-
-    func tabBarViewController() -> ESTabBarController {
-        esTabBarController = ESTabBarController()
-        
+    
+    override func viewDidLoad() {
+        delegate = self
         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")
+            tabBar.standardAppearance.configureWithOpaqueBackground()
+            tabBar.standardAppearance.backgroundImage = UIImage.imageWithColor(color: UIColor.white)
+            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()
-            }
+            tabBar.shadowImage = UIImage(named: "navbar_shadow_pic_down")
         }
         
         /// 社区
         v1 = CommunityViewController()
-        /// 商城
-        //    var v2 = ShoppingMallViewController!
         /// 兑换专区
         v2 = BackyardViewController()
         /// 发布
@@ -105,41 +355,16 @@ class BaseTabbarViewController: NSObject {
         /// 我的
         v5 = UserPersonalCenterViewController()
         
-        /// 社区
-        lottieAnimateContentView1 = BaseLottieAnimateContentView(jsonStr: "communityModuleTabbar")
-        
-        /// 商城
-        lottieAnimateContentView2 = BaseLottieAnimateContentView(jsonStr: "shoppingMallModuleTabbar")
-        
-        /// 消息
-        lottieAnimateContentView4 = BaseLottieAnimateContentView(jsonStr: "messageModuleTabbar")
+        setupChildController(controller: v1, title: "社区", image: "tabbar_home", selectedImage: "tabbar_home_pre")
+        setupChildController(controller: v2, title: "后院", image: "tabbar_shopping", selectedImage: "tabbar_shopping_pre")
+        setupChildController(controller: v3, title: "", image: "tabbar_publish", selectedImage: "tabbar_publish")
+        setupChildController(controller: v4, title: "消息", image: "tabbar_massage", selectedImage: "tabbar_massage_pre")
+        setupChildController(controller: v5, title: "我的", image: "tabbar_my", selectedImage: "tabbar_my_pre")
         
-        /// 我的
-        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]
+        UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: k333333Color], for: .selected)
         //将要进入前台的时候
         setBadge()
         NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main, using: {
@@ -156,36 +381,12 @@ class BaseTabbarViewController: NSObject {
             [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
+            PublishNewPopView.show(imageStrs: ["publish_btn_picture","publish_btn_video","publish_btn_photo","publish_btn_article"], titles: ["相册","视频","拍照","文章"], columnCount: 4) { [weak self] (index) in
                 if index != 3 {
                     let pickVc = PublishViewController()
                     pickVc.index = index
@@ -193,7 +394,7 @@ class BaseTabbarViewController: NSObject {
 //                    pickVc.index = index
                     let nav = BaseNavigationViewController.init(rootViewController: pickVc)
                     nav.modalPresentationStyle = .fullScreen
-                    BaseTabbarViewController.shared.esTabBarController.present(nav, animated: true, completion: nil)
+                    self?.present(nav, animated: true, completion: nil)
                 }else {
                     Mediator.push(H5RouterModuleType.pushPostArticle)
                 }
@@ -214,29 +415,15 @@ class BaseTabbarViewController: NSObject {
             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()
             }
         }
@@ -245,48 +432,75 @@ class BaseTabbarViewController: NSObject {
     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)
         }
     }
+    
+    func setupChildController(controller: UIViewController, title: String, image: String, selectedImage: String) {
+        
+        controller.tabBarItem.title = title
+        controller.tabBarItem.image = UIImage.init(named: image)?.withRenderingMode(.alwaysOriginal)
+        controller.tabBarItem.selectedImage = UIImage.init(named: selectedImage)?.withRenderingMode(.alwaysOriginal)
+        addChild(BaseNavigationViewController.init(rootViewController: controller))
 
-    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 BaseTabbarViewController : UITabBarControllerDelegate{
+    func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
+        AudioServicesPlaySystemSound(1519)
+         if UserModel.isTokenNil() {
+            if customSelectedIndex == 2 || customSelectedIndex == 3 || customSelectedIndex == 4 {
+                kAppDelegate.setLogin()
+                return false
+            }else {
+                self.reloadTabbar(index:customSelectedIndex)
+                self.lastIndex = customSelectedIndex
+                return true
+            }
+        }else {
+            if customSelectedIndex == 2 {
+                self.pushPublishVC()
+                return false
+            }else {
+                self.reloadTabbar(index:customSelectedIndex)
+                self.lastIndex = customSelectedIndex
+                return true
+            }
+        }
     }
     
 }
 
-extension ESTabBar {
+///UITabBarDelegate
+extension BaseTabbarViewController {
+
+    override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
+        guard let index = tabBar.items?.firstIndex(of: item) else {
+            return;
+        }
+        customSelectedIndex = index
+    }
+}
+
+extension UITabBar {
     open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
         
         let view  = super.hitTest(point, with: event)
@@ -314,3 +528,4 @@ extension ESTabBar {
         return view
     }
 }
+

+ 1 - 1
RainbowPlanet/RainbowPlanet/Manager/RegisterLoginManager/RegisterLoginManager.swift

@@ -41,7 +41,7 @@ class RegisterLoginManager: NSObject {
                 LoginNowView.removeLoginNowView()
                 kAppDelegate.setData()
             }
-            BaseTabbarViewController.shared.esTabBarController.selectedIndex = 0
+            BaseTabbarViewController.shared.selectedIndex = 0
 
         }
     }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Manager/WebViewJavascriptBridgeManager/WebViewJavascriptBridgeManager.swift

@@ -209,7 +209,7 @@ class WebViewJavascriptBridgeManager: NSObject {
             }
             // 推荐
             if wvjbModel?.params?.paramsModelPage == .join {
-                BaseTabbarViewController.shared.esTabBarController.selectedIndex = 0
+                BaseTabbarViewController.shared.selectedIndex = 0
                 BaseTabbarViewController.shared.v1.reloadSegmentedView()
                 if viewController != nil {
                     viewController?.navigationController?.popToRootViewController(animated: true)
@@ -221,7 +221,7 @@ class WebViewJavascriptBridgeManager: NSObject {
             }
             // 去星球
             if wvjbModel?.params?.paramsModelPage == .planet {
-                BaseTabbarViewController.shared.esTabBarController.selectedIndex = 0
+                BaseTabbarViewController.shared.selectedIndex = 0
                 BaseTabbarViewController.shared.v1.reloadSegmentedStarView()
                 if viewController != nil {
                     viewController?.navigationController?.popToRootViewController(animated: true)

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishEdit/Controller/PublishEditController.swift

@@ -319,7 +319,7 @@ extension PublishEditController {
         }
         self.dismissToRootViewController(animated: false) {
             NotificationCenter.default.post(name: NSNotification.Name(rawValue: "DismissFromPublishEditVc"), object: aliyunVodUpToYoPublishModel)
-            BaseTabbarViewController.shared.esTabBarController.selectedIndex = 0
+            BaseTabbarViewController.shared.selectedIndex = 0
         }
 
     }

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishNewModule/PublishEditContent/ViewController/PublishEditVideoContentViewController.swift

@@ -188,7 +188,7 @@ class PublishEditVideoContentViewController: BaseViewController {
             self.navigationController?.popViewController(animated: true)
         }else {
             self.dismissToRootViewController(animated: false) {
-                BaseTabbarViewController.shared.esTabBarController.selectedIndex = 0
+                BaseTabbarViewController.shared.selectedIndex = 0
             }
         }
     }

+ 3 - 2
RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/LoginNow/LoginNowView.swift

@@ -108,8 +108,9 @@ class LoginNowView: UIView {
     class func initLoginNowView() {
         if  LoginNowView.shared.loginNowView == nil {
             let loginNowView = LoginNowView(frame:CGRect(x: 0, y: -50, width: kScreenWidth, height: 50))
-            let tabbar = BaseTabbarViewController.shared.esTabBarController.tabBar as? ESTabBar
-            tabbar?.addSubview(loginNowView)
+//            let tabbar = BaseTabbarViewController.shared.esTabBarController.tabBar as? ESTabBar
+            let tabbar = BaseTabbarViewController.shared.tabBar
+            tabbar.addSubview(loginNowView)
             LoginNowView.shared.loginNowView = loginNowView
         }
     }

+ 1 - 5
RainbowPlanet/RainbowPlanet/Modules/RongCloudIMModule/IMChatPrivate/ViewController/IMChatPrivateViewController.swift

@@ -130,9 +130,6 @@ class IMChatPrivateViewController: RCConversationViewController {
     }
     
     override func pluginBoardView(_ pluginBoardView: RCPluginBoardView!, clickedItemWithTag tag: Int) {
-        
-        self.navigationItem.leftBarButtonItem = nil
-        self.navigationItem.rightBarButtonItem = nil
         if #available(iOS 11.0, *) {
             UIScrollView.appearance().contentInsetAdjustmentBehavior = .automatic
         } else {
@@ -140,13 +137,12 @@ class IMChatPrivateViewController: RCConversationViewController {
                 self.automaticallyAdjustsScrollViewInsets = true
             }
         }
-        
+        super.pluginBoardView(pluginBoardView, clickedItemWithTag: tag)
         WRNavigationBar.defaultNavBarBarTintColor = kThemeColor
         WRNavigationBar.defaultNavBarTitleColor = UIColor.white
         WRNavigationBar.defaultNavBarTintColor = UIColor.white
         WRNavigationBar.defaultNavBarBackgroundImage = UIImage.imageWithColor(color: kThemeColor)
         UINavigationBar.appearance().tintColor = UIColor.white
-        super.pluginBoardView(pluginBoardView, clickedItemWithTag: tag)
 
     }
     

+ 4 - 4
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/ApiMacro.swift

@@ -1,14 +1,14 @@
 /// Service
 let kPersonalService = false
 let kDevelopSever = false
-let kBetaSever = false
-let kProductSever = true
+let kBetaSever = true
+let kProductSever = false
 
 /// H5Service
 let kH5PersonalService = false
 let kH5DevelopSever = false
-let kH5BetaSever = false
-let kH5ProductSever = true
+let kH5BetaSever = true
+let kH5ProductSever = false
 
 // MARK: - 数据服务器
 public func kApiDataPrefix() -> String {