Kaynağa Gözat

Merge branch 'master' of https://git.yishihui.com/iOS/Introduce
合并代码

jsonwang 3 yıl önce
ebeveyn
işleme
cfb2d9f976

+ 13 - 12
Introduce/Aarchitecture/AppDelegate.swift

@@ -17,8 +17,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     var notificationUserInfo: [String: Any]?
     
     func application(_: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
-        // 初始化配置
-        INAppConfigUtil.pageConfig()
         if launchOptions?.keys.contains(UIApplication.LaunchOptionsKey.remoteNotification) ?? false {
             notificationUserInfo = launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification] as? [String: Any]
             if notificationUserInfo != nil && notificationUserInfo?.keys.contains("type") ?? false {
@@ -26,7 +24,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
             }
         }
         // 配置启动项
-        INAppConfigUtil.applicationConfig(launchOptions:launchOptions)
+        DispatchQueue.global().async {
+            // 初始化配置
+            INAppConfigUtil.pageConfig()
+        #if DEBUG
+        #else
+            INAppConfigUtil.applicationConfig(launchOptions:launchOptions)
+        #endif
+
+        }
 //        BFMaterialConfig.shared.choseType = .single
         return true
     }
@@ -38,8 +44,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     func applicationDidEnterBackground(_: UIApplication) {
         // 热启动重新生成SubSesstionId
         isEnterBack = true
-        PQSingletoMemoryUtil.shared.createSubSesstionId()
-        BFConfig.shared.subSessionId = PQSingletoMemoryUtil.shared.subSessionid
+        DispatchQueue.global().async {
+            PQSingletoMemoryUtil.shared.createSubSesstionId()
+            BFConfig.shared.subSessionId = PQSingletoMemoryUtil.shared.subSessionid
+        }
     }
 
     func application(_: UIApplication, supportedInterfaceOrientationsFor _: UIWindow?) -> UIInterfaceOrientationMask {
@@ -56,12 +64,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
             INAppConfigUtil.appLaunchReportUpload(isHotLaunch: true)
             isEnterBack = false
         }
-        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {
-            if #available(iOS 14, *) {
-                ATTrackingManager.requestTrackingAuthorization { status in
-                    
-                }
-            }
-        }
     }
 }

+ 7 - 4
Introduce/Record/INAppConfigUtil.swift

@@ -16,7 +16,7 @@ class INAppConfigUtil: NSObject {
     class func pageConfig() {
         BFConfig.shared.appType = "20"
         BFConfig.shared.appId = "1599191466"
-        BFConfig.shared.styleColor = .intrGreen
+        BFConfig.shared.styleColor = .intrBlue
         BFConfig.shared.statusBarStyle = .light
         BFConfig.shared.styleBackGroundColor = UIColor.black
         BFConfig.shared.styleTitleColor = UIColor.white
@@ -69,14 +69,17 @@ class INAppConfigUtil: NSObject {
         buglyConfig.reportLogLevel = .warn
         #if DEBUG
             buglyConfig.version = versionName + ".6666"
-            buglyConfig.debugMode = true
+            buglyConfig.debugMode = false
+            buglyConfig.unexpectedTerminatingDetectionEnable = false
+            buglyConfig.blockMonitorEnable = false
+        
         #else
             buglyConfig.version = versionName + "." + versionCode
+            buglyConfig.unexpectedTerminatingDetectionEnable = true
+            buglyConfig.blockMonitorEnable = true
         #endif
         buglyConfig.channel = channel
         buglyConfig.deviceIdentifier = deviceId ?? ""
-        buglyConfig.unexpectedTerminatingDetectionEnable = true
-        buglyConfig.blockMonitorEnable = true
         buglyConfig.blockMonitorTimeout = 2
         Bugly.start(withAppId: appID, config: buglyConfig)
     }

+ 14 - 2
Introduce/Record/INIntroduceController.swift

@@ -106,7 +106,7 @@ class INIntroduceController: BFBaseViewController {
         stripSwithView.snp.makeConstraints { make in
             make.left.equalTo(backButton!.snp.right).offset(5)
             make.top.height.equalTo(backButton!)
-            if assets!.count > 1 {
+            if (assets?.count ?? 0) > 1 {
                 make.width.equalTo(cScreenWidth).priority(.high)
             }else{
                 make.width.equalTo(0).priority(.high)
@@ -115,7 +115,11 @@ class INIntroduceController: BFBaseViewController {
         addMaterialBtn.snp.makeConstraints { make in
             make.left.equalTo(stripSwithView.snp.right).offset(-2)
             make.top.height.equalTo(backButton!)
-            make.width.equalTo(addMaterialBtn.snp.height)
+            if (assets?.count ?? 0) < 20 {
+                make.width.equalTo(addMaterialBtn.snp.height)
+            }else {
+                make.width.equalTo(0)
+            }
             make.right.lessThanOrEqualTo(exportBtn.snp.left).offset(-15)
         }
         
@@ -139,6 +143,14 @@ class INIntroduceController: BFBaseViewController {
     // MARK: - Button action
     func updateAsset(_ phAssets:[PHAsset]) {
         recordScreenVC.fetchMaterial(phAssets)
+        if recordScreenVC.itemModels.count >= 20 {
+            addMaterialBtn.snp.remakeConstraints { make in
+                make.left.equalTo(stripSwithView.snp.right).offset(-2)
+                make.top.height.equalTo(backButton!)
+                make.width.equalTo(0)
+                make.right.lessThanOrEqualTo(exportBtn.snp.left).offset(-15)
+            }
+        }
         resetStripSwithView(recordScreenVC.itemModels.count)
     }
     

+ 21 - 4
Introduce/Record/INPhotoVideosController.swift

@@ -108,13 +108,14 @@ class INPhotoVideosController: BFBaseViewController {
     lazy var photoMaterialVc: BFPhotosMaterialController = {
         let vc = BFPhotosMaterialController()
         vc.maxChoseNum = maxMaterialNum
-//        vc.msgType = .all
+        vc.msgType = .all
         vc.showGIF = false
         vc.view.backgroundColor = .black
         vc.updateFrame(newFrame: CGRect(x: 0, y: navHeadImageView?.bottomY ?? 0, width: cScreenWidth, height: cScreenHeigth - cDevice_iPhoneTabBarHei - (navHeadImageView?.bottomY ?? 0)))
         vc.selectedMaterialHandle = { [weak self] materialData, selectedPhotoData, _, _ in
             self?.chosedAsset = selectedPhotoData
         }
+        
         vc.detailMaterialHandle = { [weak self] _, currentMaterialData in
             guard let wself = self else { return }
             
@@ -125,7 +126,7 @@ class INPhotoVideosController: BFBaseViewController {
             detailVc.materialDetailClickHandle = { [weak self] isMaterialSelected, materialData in
                 guard let wself = self else { return }
                 
-                if isMaterialSelected != materialData?.isSelected {
+                if isMaterialSelected != (materialData?.isSelected ?? false) {
                     wself.photoMaterialVc.updateMaterials(isSelected:!isMaterialSelected, materialData: materialData)
                 }
             }
@@ -138,7 +139,13 @@ class INPhotoVideosController: BFBaseViewController {
                 currentMaterialData?.selectedIndex = (self?.chosedAsset?.count ?? 0) + 1
             }
             detailVc.materialData = currentMaterialData
-            wself.navigationController?.pushViewController(detailVc, animated: true)
+//            wself.navigationController?.pushViewController(detailVc, animated: true)
+            if let nav = wself.navigationController {
+                nav.pushViewController(detailVc, animated: true)
+            }else{
+                detailVc.modalPresentationStyle = .fullScreen
+                wself.present(detailVc, animated: true, completion: nil)
+            }
         }
         vc.emptyRefreshHandle = {[weak self] msgType in
             if msgType == .image {
@@ -257,7 +264,17 @@ class INPhotoVideosController: BFBaseViewController {
 //
             if presentingViewController != nil {
                 nextBtnCallBack?(assets)
-                dismiss(animated: true, completion: nil)
+                if self.presentedViewController is  BFMaterialDetailController {
+                    dismiss(animated: false) {[weak self] in
+                        guard let wself = self else { return }
+                        
+                        if wself.presentingViewController != nil{
+                            wself.dismiss(animated: true, completion: nil)
+                        }
+                    }
+                }else{
+                    dismiss(animated: true, completion: nil)
+                }
             }else {
                 let vc = INIntroduceController()
                 vc.assets = assets

+ 5 - 5
Introduce/Record/INRecorderController.swift

@@ -105,7 +105,6 @@ class INRecorderController: BFBaseViewController {
  
     lazy var protocolLab: TYAttributedLabel = {
    
-        
         let protocolLab = TYAttributedLabel()
         protocolLab.highlightedLinkBackgroundColor = UIColor.clear
         protocolLab.backgroundColor = UIColor.clear
@@ -173,9 +172,10 @@ class INRecorderController: BFBaseViewController {
     }
     
     override func viewDidLoad() {
-        
-        if #available(iOS 14, *) {
-            ATTrackingManager.requestTrackingAuthorization { [weak self] _ in
+        DispatchQueue.global().async {[weak self] in
+            if #available(iOS 14, *) {
+                ATTrackingManager.requestTrackingAuthorization { [weak self] _ in
+                }
             }
         }
         super.viewDidLoad()
@@ -190,7 +190,7 @@ class INRecorderController: BFBaseViewController {
         view.addSubview(centerView)
         view.addSubview(settingBtn)
         centerView.snp.makeConstraints { make in
-            make.width.equalTo(140)
+            make.width.equalToSuperview()
             make.height.equalTo(209)
             make.center.equalToSuperview()
         }

+ 12 - 16
Introduce/Record/INVideoExportController.swift

@@ -237,22 +237,20 @@ class INVideoExportController: BFBaseViewController {
         let export = BFRecordExport()
 
         export.progress = { [weak self] progress in
-            DispatchQueue.main.async { [weak self] in
-                if let wself = self {
-//                    let width = export.data?.first?.width ?? 0
-                    wself.progressL.text = String(format: "%d%%", Int(progress * 100))
-                    wself.progressView.snp.updateConstraints { make in
-                        make.width.equalTo(wself.playerLayer.bounds.width * CGFloat(progress))
-                    }
+            DispatchQueue.main.async {[weak self] in
+                guard let wself = self else { return }
+                
+                wself.progressL.text = String(format: "%d%%", Int(progress * 100))
+                wself.progressView.snp.updateConstraints { make in
+                    make.width.equalTo(wself.playerLayer.bounds.width * CGFloat(progress))
                 }
             }
         }
 
         export.exportCompletion = { [weak self] error, url in
             DispatchQueue.main.async { [weak self] in
-                guard let wself = self else {
-                    return
-                }
+                guard let wself = self else { return }
+                
                 UIApplication.shared.isIdleTimerDisabled = false
 
                 wself.resetViewStatus()
@@ -653,13 +651,11 @@ class INVideoExportController: BFBaseViewController {
             PHPhotoLibrary.shared().performChanges {
                 PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url)
             } completionHandler: { [weak self] isFinished, _ in
-                guard let wself = self else {
-                    return
-                }
+                guard let wself = self else { return }
+                
                 if isFinished {
-                    DispatchQueue.main.async {
-                        cShowHUB(superView: nil, msg: "compose_tips_successfully".BFLocale, style: 1)
-                    }
+                    cShowHUB(superView: nil, msg: "compose_tips_successfully".BFLocale, style: 1)
+                    
                     if wself.saveAllBtn.isSelected {
                         wself.hasSaveAll = true
                     } else if wself.saveOnlyBtn.isSelected {