Bladeren bron

修复了启动页面延迟的问题

jeremy 5 jaren geleden
bovenliggende
commit
d4bda28f98

+ 0 - 2
RainbowPlanet/Podfile

@@ -44,8 +44,6 @@ target 'RainbowPlanet' do
   pod 'FSPagerView'
   # 小红点
   pod 'PPBadgeViewSwift'
-  # bug统计
-  pod 'Bugly'
   # 动画效果
 #  pod 'pop'
   # pop动画

+ 1 - 5
RainbowPlanet/Podfile.lock

@@ -22,7 +22,6 @@ PODS:
   - AliyunVideoSDKPro (3.11.0)
   - BaiduMapKit (4.4.2)
   - BMKLocationKit (1.5.0)
-  - Bugly (2.5.0)
   - Cache (5.2.0)
   - DeviceKit (2.1.0)
   - DPScrollNumberLabel (0.0.2)
@@ -105,7 +104,6 @@ DEPENDENCIES:
   - AliyunVideoSDKPro
   - BaiduMapKit
   - BMKLocationKit (= 1.5.0)
-  - Bugly
   - Cache
   - DeviceKit
   - DPScrollNumberLabel
@@ -159,7 +157,6 @@ SPEC REPOS:
     - AliyunVideoSDKPro
     - BaiduMapKit
     - BMKLocationKit
-    - Bugly
     - Cache
     - DeviceKit
     - DPScrollNumberLabel
@@ -210,7 +207,6 @@ SPEC CHECKSUMS:
   AliyunVideoSDKPro: da710c1e7fb93b1e9a741b3619814c6608780b4b
   BaiduMapKit: 11acde2e7c06e31b7de60b323880a5eb7c4dccb6
   BMKLocationKit: 40d267478acd8704ddebd0e9deaddc727b13df9f
-  Bugly: 3ca9f255c01025582df26f9222893b383c7e4b4e
   Cache: 807c5d86d01a177f06ede9865add3aea269bbfd4
   DeviceKit: 2f6c28410d5a5fe2977be7f8cb9b313d28bdae69
   DPScrollNumberLabel: 5124eaccf3029bb84116de391e1273cba676f4f5
@@ -253,6 +249,6 @@ SPEC CHECKSUMS:
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: 79815c27ca874bd41989ecaec05f861b486804f1
+PODFILE CHECKSUM: 5ee04af728b239abe6553f922c24805895ba3bed
 
 COCOAPODS: 1.7.5

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

@@ -308,7 +308,6 @@
 		A7AD2795231365470099B3E0 /* QRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7AD2794231365470099B3E0 /* QRCode.swift */; };
 		A7B4E7352281907A0012914A /* CMSModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E7342281907A0012914A /* CMSModel.swift */; };
 		A7B4E73A228192D20012914A /* CMSTemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E739228192D10012914A /* CMSTemplateModel.swift */; };
-		A7BA18FD230D5B6F00E3B969 /* RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7BA18FC230D5B6F00E3B969 /* RootViewController.swift */; };
 		A7BA1902230EA80000E3B969 /* TGCaculateNumberTool.m in Sources */ = {isa = PBXBuildFile; fileRef = A7BA1901230EA80000E3B969 /* TGCaculateNumberTool.m */; };
 		A7BB684F2268DCEC00AB07A2 /* SelfRecommendationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7BB684D2268DCEC00AB07A2 /* SelfRecommendationViewController.swift */; };
 		A7BB68552268DE8600AB07A2 /* SelfRecommendationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7BB68542268DE8600AB07A2 /* SelfRecommendationView.swift */; };
@@ -976,7 +975,6 @@
 		A7AD2794231365470099B3E0 /* QRCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCode.swift; sourceTree = "<group>"; };
 		A7B4E7342281907A0012914A /* CMSModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CMSModel.swift; sourceTree = "<group>"; };
 		A7B4E739228192D10012914A /* CMSTemplateModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CMSTemplateModel.swift; sourceTree = "<group>"; };
-		A7BA18FC230D5B6F00E3B969 /* RootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewController.swift; sourceTree = "<group>"; };
 		A7BA1900230EA80000E3B969 /* TGCaculateNumberTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TGCaculateNumberTool.h; sourceTree = "<group>"; };
 		A7BA1901230EA80000E3B969 /* TGCaculateNumberTool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TGCaculateNumberTool.m; sourceTree = "<group>"; };
 		A7BB684D2268DCEC00AB07A2 /* SelfRecommendationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelfRecommendationViewController.swift; sourceTree = "<group>"; };
@@ -3350,7 +3348,6 @@
 		A7BA18FB230D5B4D00E3B969 /* RootViewController */ = {
 			isa = PBXGroup;
 			children = (
-				A7BA18FC230D5B6F00E3B969 /* RootViewController.swift */,
 			);
 			path = RootViewController;
 			sourceTree = "<group>";
@@ -5418,7 +5415,6 @@
 				A770E5DD22CEDF4F00CBD0A4 /* OpenAppModel.swift in Sources */,
 				A719EE6E22AF441F001AAC98 /* CommunityViewController.swift in Sources */,
 				BD13B6C622BA034D008BB323 /* PublishEditTitleCell.swift in Sources */,
-				A7BA18FD230D5B6F00E3B969 /* RootViewController.swift in Sources */,
 				A72A72C522321DE000B21995 /* WKWebViewConfig.swift in Sources */,
 				A72A72BB22321DE000B21995 /* Extension+UILabel.swift in Sources */,
 				BDAF83A822B343C50004BCC3 /* RecommendBottomCommentView.swift in Sources */,

+ 33 - 42
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift

@@ -14,66 +14,57 @@ import Kingfisher
 extension AppDelegate {
 
     func initWindow(didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
+        
         window = UIWindow.init(frame: UIScreen.main.bounds)
         window?.backgroundColor = UIColor.white
-        //版本更新
-        _ = UpdateVersionManager.shared
-        let vc = RootViewController()
-        vc.launchOptions = launchOptions
-        window?.rootViewController = vc
         window?.makeKeyAndVisible()
-        //基础配置
-        DispatchQueue.global(qos: .default).async {
-            [weak self] in
-            /// 城市转换
-            self?.setBaiduToCityFactory()
-            /// 授权处理
-            self?.setPermission()
-            /// 设置默认为快递
-            let deliveryMethodTypeModel = DeliveryMethodTypeModel.shared()
-            deliveryMethodTypeModel.deliveryMethodType = "2"
-            DeliveryMethodTypeModel.shared().setModel(model: deliveryMethodTypeModel)
-            //网络监听
-            //        AlamofireReachabilityManager.shared.reachability()
-
-            DispatchQueue.main.async {
-                /// 设置全局的tabbar
-                self?.setTabbarAppearence()
-                /// 设置全局的navigation
-                self?.setNavBarAppearence()
-                /// 设置全局的TableView
-                self?.setTableViewAppearance()
-                //键盘处理
-                IQKeyboardManagerSwiftManager.shared().initIQKeyboardManagerSwift()
-            }
-        }
-
+        // 设置Tabbar
+        kAppDelegate.setTabbarController()
+        //  引导页
+        kAppDelegate.setGuidePageView()
+        // 授权处理
+        setPermission()
+        // 初始化百度地图
+        BaiduMapManager.shared.initBaiduMap()
+        // 百度开始定位
+        BaiduMapManager.shared.startLocation()
+        // 融云
+        RongCloudIMManager.shared.initRCIM()
+        // 设置全局的tabbar
+        setTabbarAppearence()
+        // 设置全局的navigation
+        setNavBarAppearence()
+        // 设置全局的TableView
+        setTableViewAppearance()
+        // 键盘处理
+        IQKeyboardManagerSwiftManager.shared().initIQKeyboardManagerSwift()
+        // 升级版本
+        UpdateVersionManager.shared.initUpdateVersionManager()
+        
     }
     
     /// 设置Tabbar
     func setTabbarController() {
         /// 判断初始化页面
         if (UserModel.shared().getModel()?.token) != nil { //是否已经登录
-            SwiftMoyaNetWorkServiceUser.shared().userRefreshApi {
-                [weak self] _ in
 
-                if(UserModel.shared().getModel()?.isFollowSuggestTopic == 0 || UserModel.shared().getModel()?.isFollowSuggestTopic == nil ) {//设置性别话题
-                    self?.setNoLoginOut()
-                }else {
-                    self?.window?.rootViewController = BaseTabbarViewController.shared.tabBarViewController()
-                    
-                    self?.setData()
-                    
-                }
+            if(UserModel.shared().getModel()?.isFollowSuggestTopic == 0 || UserModel.shared().getModel()?.isFollowSuggestTopic == nil ) {//设置性别话题
+                setNoLoginOut()
+            }else {
+                window?.rootViewController = BaseTabbarViewController.shared.tabBarViewController()
+                setData()
             }
         }else {// 进入首页
             setNoLoginOut()
         }
     }
     
-    
     /// 设置登录时用的数据
     func setData() {
+        // 配置
+        SwiftMoyaNetWorkServiceConfig.shared().configApi(completion: {_ -> (Void) in }) { _ in }
+        // 刷新token
+//        SwiftMoyaNetWorkServiceUser.shared().userRefreshApi { _ in}
         //U米
         UserMemberTotalBeanViewModel.shared.userMemberGetTotalBeanApiInterval()
         //获取消息的小红点

+ 0 - 89
RainbowPlanet/RainbowPlanet/Base/RootViewController/RootViewController.swift

@@ -1,89 +0,0 @@
-//
-//  RootViewController.swift
-//  RainbowPlanet
-//
-//  Created by 南鑫林 on 2019/8/21.
-//  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
-
-import UIKit
-import SnapKit
-import SwiftyJSON
-
-class RootViewController: BaseViewController {
-    
-    var launchOptions: [UIApplication.LaunchOptionsKey: Any]?
-    
-    deinit {
-        NXLLog("deinit")
-    }
-
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        setupViews()
-        setupLayouts()
-        setupData()
-    }
-    
-    override func setupViews() {
-        navigationBar.isHidden = true
-        view.backgroundColor = UIColor.clear
-        view.addSubview(iconImageView)
-        view.addSubview(imageView)
-    }
-    
-    override func setupLayouts() {
-        
-        iconImageView.snp.makeConstraints {(make) in
-            make.bottom.equalTo(-43.5)
-            make.width.equalTo(159)
-            make.height.equalTo(83)
-            make.centerX.equalToSuperview()
-        }
-        
-        imageView.snp.makeConstraints { (make) in
-            make.top.left.right.equalToSuperview()
-            make.bottom.equalTo(iconImageView.snp.top).offset(-40)
-        }
-    }
-    
-    override func setupData() {
-        SwiftMoyaNetWorkServiceConfig.shared().configApi(completion: {[weak self] (data) -> (Void) in
-            //初始化百度地图
-            BaiduMapManager.shared.initBaiduMap()
-            //百度开始定位
-            BaiduMapManager.shared.startLocation()
-            //初始化友盟
-            UMManager.shared.initUM(launchOptions: self?.launchOptions)
-            // Bugly
-            Bugly.start(withAppId: "4e2f8cf865")
-            //设置Tabbar
-            kAppDelegate.setTabbarController()
-            // 引导页
-            kAppDelegate.setGuidePageView()
-            // rom
-            _  = RongCloudIMManager.shared
-            self?.view?.ly_hideEmpty()
-        }) { [weak self] loadingStatus in
-            self?.iconImageView.isHidden = true
-            self?.iconImageView.isHidden = true
-            DIYEmptyView.emptyNoDataActionView(view: self?.view,imageStr: .five,detailStr: .five,btnTitleStr: .one, btnClickBlock: { [weak self] in
-                self?.setupData()
-            })
-        }
-    }
-    
-    lazy var iconImageView: UIImageView = {
-        let iconImageView = UIImageView()
-        iconImageView.image = kImage(name: "default_logo")
-        return iconImageView
-    }()
-    
-    lazy var imageView: UIImageView = {
-        let imageView = UIImageView()
-        imageView.image = kImage(name: "default_image")
-        imageView.contentMode = .scaleAspectFill
-        return imageView
-    }()
-
-}

+ 0 - 4
RainbowPlanet/RainbowPlanet/Macro/RainbowPlanet-Bridging-Header.h

@@ -68,10 +68,6 @@
 // 阿里云一建登录
 #import "ATAuthSDK/ATAuthSDK.h"
 
-// bugly
-#import <Bugly/Bugly.h>
-
-
 //  KSMediaPicker所依靠的OC文件
 #import "KSMediaPickerCollectionView.h"
 #import "KSVideoPlayerBaseView.h"

+ 12 - 2
RainbowPlanet/RainbowPlanet/Manager/AppStoreManager/AppStoreManager.swift

@@ -21,12 +21,22 @@ class AppStoreManager: NSObject {
     
     /// 跳转到AppStore
     func appStore() {
-        UIApplication.shared.openURL(URL(string: kAppStore)!)
+        let kAppStoreURL = URL(string: kAppStore)
+        if #available(iOS 10, *) {
+            UIApplication.shared.open(kAppStoreURL!, options: [:], completionHandler: nil)
+        } else {
+            UIApplication.shared.openURL(kAppStoreURL!)
+        }
     }
     
     /// 跳转到AppStore评论
     func appStoreReview() {
-        UIApplication.shared.openURL(URL(string: kAppStoreReview)!)
+        let kAppStoreReviewURL = URL(string: kAppStore)
+        if #available(iOS 10, *) {
+            UIApplication.shared.open(kAppStoreReviewURL!, options: [:], completionHandler: nil)
+        } else {
+            UIApplication.shared.openURL(kAppStoreReviewURL!)
+        }
     }
     
     ///只能评分,且一年只能使用三次弹框。

+ 42 - 41
RainbowPlanet/RainbowPlanet/Manager/RongCloudIMManager/RongCloudIMManager.swift

@@ -24,48 +24,49 @@ class RongCloudIMManager: NSObject {
     
     // MARK: 私有化init方法
     /// 私有化init方法
-    private override init() {
-        super.init()
+    private override init() {}
+    
+    /// 初始化融云
+    func initRCIM() {
         if kPersonalService /** 接口前缀-个人服务器*/ {
-            RCIM.shared()?.initWithAppKey(kRongCloudIMDevAppKey)
-        }else if kDevelopSever /** 接口前缀-开发服务器*/ {
-            RCIM.shared()?.initWithAppKey(kRongCloudIMDevAppKey)
-        } else if kBetaSever /** 接口前缀-测试服务器*/{
-            RCIM.shared()?.initWithAppKey(kRongCloudIMDevAppKey)
-        }else if kProductSever /** 接口前缀-生产服务器*/ {
-            RCIM.shared()?.initWithAppKey(kRongCloudIMProAppKey)
-        }
-        //打印日志
-        RCIMClient.shared()?.logLevel = .log_Level_Info
-       //网络状态变化。
-        RCIM.shared()?.connectionStatusDelegate = self
-       //开启消息撤回功能
-        RCIM.shared()?.enableMessageRecall = true
-       //开启输入状态监听
-        RCIM.shared()?.enableTypingStatus = true
-       //设置显示未注册的消息
-       //如:新版本增加了某种自定义消息,但是老版本不能识别,开发者可以在旧版本中预先自定义这种未识别的消息的显示
-        RCIM.shared()?.showUnkownMessage = true
-        RCIM.shared()?.showUnkownMessageNotificaiton = true
-       //用户头像
-        RCIM.shared()?.userInfoDataSource = self
-       //开启发送已读回执
-        RCIM.shared()?.enabledReadReceiptConversationTypeList = [RCConversationType.ConversationType_PRIVATE,RCConversationType.ConversationType_DISCUSSION,RCConversationType.ConversationType_GROUP]
-       /*!
-        是否将用户信息和群组信息在本地持久化存储,默认值为NO
-        
-        @discussion 如果设置为NO,则SDK在需要显示用户信息时,会调用用户信息提供者获取用户信息并缓存到Cache,此Cache在App生命周期结束时会被移除,下次启动时会再次通过用户信息提供者获取信息。
-        如果设置为YES,则会将获取到的用户信息持久化存储在本地,App下次启动时Cache会仍然有效。
-        */
-        RCIM.shared()?.enablePersistentUserInfoCache = false
-       //开启多端未读状态同步
-        RCIM.shared()?.enableSyncReadStatus = true
-       //设置头像为圆形
-        RCIM.shared()?.globalMessageAvatarStyle = .USER_AVATAR_RECTANGLE
-        RCIM.shared()?.globalConversationAvatarStyle = .USER_AVATAR_CYCLE
-       //设置优先使用WebView打开URL
-        RCIM.shared()?.embeddedWebViewPreferred = true
-
+             RCIM.shared()?.initWithAppKey(kRongCloudIMDevAppKey)
+         }else if kDevelopSever /** 接口前缀-开发服务器*/ {
+             RCIM.shared()?.initWithAppKey(kRongCloudIMDevAppKey)
+         } else if kBetaSever /** 接口前缀-测试服务器*/{
+             RCIM.shared()?.initWithAppKey(kRongCloudIMDevAppKey)
+         }else if kProductSever /** 接口前缀-生产服务器*/ {
+             RCIM.shared()?.initWithAppKey(kRongCloudIMProAppKey)
+         }
+         //打印日志
+         RCIMClient.shared()?.logLevel = .log_Level_Info
+        //网络状态变化。
+         RCIM.shared()?.connectionStatusDelegate = self
+        //开启消息撤回功能
+         RCIM.shared()?.enableMessageRecall = true
+        //开启输入状态监听
+         RCIM.shared()?.enableTypingStatus = true
+        //设置显示未注册的消息
+        //如:新版本增加了某种自定义消息,但是老版本不能识别,开发者可以在旧版本中预先自定义这种未识别的消息的显示
+         RCIM.shared()?.showUnkownMessage = true
+         RCIM.shared()?.showUnkownMessageNotificaiton = true
+        //用户头像
+         RCIM.shared()?.userInfoDataSource = self
+        //开启发送已读回执
+         RCIM.shared()?.enabledReadReceiptConversationTypeList = [RCConversationType.ConversationType_PRIVATE,RCConversationType.ConversationType_DISCUSSION,RCConversationType.ConversationType_GROUP]
+        /*!
+         是否将用户信息和群组信息在本地持久化存储,默认值为NO
+         
+         @discussion 如果设置为NO,则SDK在需要显示用户信息时,会调用用户信息提供者获取用户信息并缓存到Cache,此Cache在App生命周期结束时会被移除,下次启动时会再次通过用户信息提供者获取信息。
+         如果设置为YES,则会将获取到的用户信息持久化存储在本地,App下次启动时Cache会仍然有效。
+         */
+         RCIM.shared()?.enablePersistentUserInfoCache = false
+        //开启多端未读状态同步
+         RCIM.shared()?.enableSyncReadStatus = true
+        //设置头像为圆形
+         RCIM.shared()?.globalMessageAvatarStyle = .USER_AVATAR_RECTANGLE
+         RCIM.shared()?.globalConversationAvatarStyle = .USER_AVATAR_CYCLE
+        //设置优先使用WebView打开URL
+         RCIM.shared()?.embeddedWebViewPreferred = true
     }
     
     /// 链接融云

+ 31 - 31
RainbowPlanet/RainbowPlanet/Manager/UpdateVersionManager/ViewModel/UpdateVersionManager.swift

@@ -20,38 +20,38 @@ class UpdateVersionManager: NSObject {
     weak var observe : NSObjectProtocol?
     
     static let shared : UpdateVersionManager = UpdateVersionManager()
+    
+    /// 初始化升级
+    func initUpdateVersionManager() {
+           //启动程序
+           observe = NotificationCenter.default.addObserver(forName: UIApplication.didFinishLaunchingNotification, object: nil, queue: OperationQueue.main, using: {
+               [weak self] (notification) in
+               self?.configUpGrade()
+               
+           })
+           //程序进入后台
+           observe = NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main, using: {
+               [weak self] (notification) in
+               if self?.updateVersionView != nil {
+                   self?.updateVersionView?.hide()
+               }
+           })
+           //将要进入前台的时候
+           observe = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main, using: {
+               [weak self] (notification) in
+               self?.configUpGrade()
+               //基础配置
+               SwiftMoyaNetWorkServiceConfig.shared().configApi(completion: {(data) -> (Void) in}){_ in}
+           })
+           //程序即将退出
+           observe = NotificationCenter.default.addObserver(forName: UIApplication.willTerminateNotification, object: nil, queue: OperationQueue.main, using: {
+               [weak self] (notification) in
+               if self?.updateVersionView != nil {
+                   self?.updateVersionView?.hide()
+               }
+           })
+       }
 
-    override init() {
-        super.init()
-        //启动程序
-        observe = NotificationCenter.default.addObserver(forName: UIApplication.didFinishLaunchingNotification, object: nil, queue: OperationQueue.main, using: {
-            [weak self] (notification) in
-            self?.configUpGrade()
-            
-        })
-        //程序进入后台
-        observe = NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main, using: {
-            [weak self] (notification) in
-            if self?.updateVersionView != nil {
-                self?.updateVersionView?.hide()
-            }
-        })
-        //将要进入前台的时候
-        observe = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main, using: {
-            [weak self] (notification) in
-            self?.configUpGrade()
-            //基础配置
-            SwiftMoyaNetWorkServiceConfig.shared().configApi(completion: {(data) -> (Void) in}){_ in}
-        })
-        //程序即将退出
-        observe = NotificationCenter.default.addObserver(forName: UIApplication.willTerminateNotification, object: nil, queue: OperationQueue.main, using: {
-            [weak self] (notification) in
-            if self?.updateVersionView != nil {
-                self?.updateVersionView?.hide()
-            }
-        })
-
-    }
     // 用于判断当前系统版本是否低于指定版本
     func systemVersion(below aVersionString: String) -> Bool
     {

+ 2 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/Info.plist

@@ -244,6 +244,8 @@
 	</array>
 	<key>UIRequiresFullScreen</key>
 	<true/>
+	<key>UIStatusBarStyle</key>
+	<string>UIStatusBarStyleLightContent</string>
 	<key>UISupportedInterfaceOrientations</key>
 	<array>
 		<string>UIInterfaceOrientationPortrait</string>