소스 검색

修改一批 bug

100Years 3 달 전
부모
커밋
d327264b7c

+ 2 - 2
Girly.xcodeproj/project.pbxproj

@@ -750,7 +750,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1;
+				CURRENT_PROJECT_VERSION = 2;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -785,7 +785,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1;
+				CURRENT_PROJECT_VERSION = 2;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;

+ 0 - 1
Girly/Business/Flash/TSFlashVC.swift

@@ -79,7 +79,6 @@ class TSFlashVC: TSBaseVC{
     
     override func createView() {
         edgesForExtendedLayout = [.top,.left,.right]
-        view.backgroundColor = "#050505".color
         navBarContentView.addSubview(navBarView)
         navBarView.snp.makeConstraints { make in
             make.edges.equalToSuperview()

+ 3 - 2
Girly/Business/Flash/VC/TSFlashLightVC.swift

@@ -90,7 +90,7 @@ class TSFlashLightVC: TSBaseVC {
         if setToolView.isHidden == true {
             UIView.animate(withDuration: 0.5, delay: 0, options: []) {
                 self.setToolView.isHidden = false
-                self.setToolView.submitBtn.setTitle(self.isOpen ? "Close" : "Open", for: .normal)
+                
             }
         }
     }
@@ -100,12 +100,13 @@ class TSFlashLightVC: TSBaseVC {
         if isOpen {
             self.lightImageView.isHidden = false
             self.flashlightImageView.image = UIImage(named: "flashlight_on")
-            self.flashlight.turnOn(brightness: 0.5)
+            self.flashlight.turnOn(brightness: Float(currentValue))
         }else{
             self.lightImageView.isHidden = true
             self.flashlightImageView.image = UIImage(named: "flashlight_off")
             self.flashlight.turnOff()
         }
+        self.setToolView.submitBtn.setTitle(self.isOpen ? "Close" : "Open", for: .normal)
     }
     
     deinit {

+ 34 - 17
Girly/Business/Flash/VC/TSNightLightVC.swift

@@ -10,6 +10,23 @@ class TSNightLightVC: TSBaseVC {
     private var isOpen = false
     private var currentValue:CGFloat = 0.5
     
+    
+    lazy var myTimer: TSCustomTimer = {
+        let customTimer = TSCustomTimer(interval: 1.0,repeats: true) { [weak self]  in
+            guard let self = self else { return }
+            
+            if setToolView.countdown <= 0{
+                stopMyTimer()//关闭定时器
+                isOpen = false
+                showToView()//退出全屏
+            }else {
+                setToolView.countdown -= 1
+                setToolView.timeLabel.text = setToolView.countdown.toHourMinuteSecondString()
+            }
+        }
+        return customTimer
+    }()
+    
     lazy var shapeView: TSLightShapeView = {
         let shapeView = TSLightShapeView()
         shapeView.imageNamed = "bold_roundness_shape"
@@ -35,11 +52,14 @@ class TSNightLightVC: TSBaseVC {
                     setToolView.isHidden = true
                 }
                 UIDevice.keepScreenAwake()
-                setToolView.myTimer.start()
+                
+                if(setToolView.countdown > 0){
+                    startMyTimer()
+                }
                 setToolView.submitBtn.setTitle("close".localized, for: .normal)
             }else{
                 UIDevice.allowScreenSleep()
-                setToolView.myTimer.stop()
+                stopMyTimer()
                 setToolView.submitBtn.setTitle("open".localized, for: .normal)
             }
         }
@@ -77,15 +97,23 @@ class TSNightLightVC: TSBaseVC {
         if setToolView.isHidden == true {
             UIView.animate(withDuration: 0.5, delay: 0, options: []) {
                 self.setToolView.isHidden = false
-                self.setToolView.submitBtn.setTitle(self.isOpen ? "Close" : "Open", for: .normal)
             }
-            UIDevice.allowScreenSleep()
         }
+        self.setToolView.submitBtn.setTitle(self.isOpen ? "Close" : "Open", for: .normal)
+        UIDevice.allowScreenSleep()
     }
     
+    func startMyTimer(){
+        myTimer.start()
+    }
+    
+    func stopMyTimer(){
+        myTimer.stop()
+    }
     
     deinit {
         UIDevice.allowScreenSleep()
+        myTimer.stop()
     }
 }
 
@@ -108,7 +136,7 @@ class TSNightSetToolView: TSBaseView {
     var isShow = true
     
     
-    private var countdown:Int = 0
+    var countdown:Int = 0
     
     lazy var titleLabel1: UILabel = {
         let titleLabel1 = UILabel.createLabel(text: "Brightness".localized,font: .font(size: 14,weight: .medium),textColor: .white)
@@ -143,14 +171,7 @@ class TSNightSetToolView: TSBaseView {
         return submitBtn
     }()
     
-    lazy var myTimer: TSCustomTimer = {
-        let customTimer = TSCustomTimer(interval: 1.0,repeats: true) { [weak self]  in
-            guard let self = self else { return }
-            countdown -= 1
-            timeLabel.text = countdown.toHourMinuteSecondString()
-        }
-        return customTimer
-    }()
+
     //时间选择器
     lazy var timerView: TSTimerView = {
         let timerView = TSTimerView()
@@ -268,10 +289,6 @@ class TSNightSetToolView: TSBaseView {
         self.timerView.isHidden = false
     }
     
-    
-    deinit {
-        myTimer.stop()
-    }
 
 }
 

+ 13 - 11
Girly/Business/Light/VC/View/TSLightShapeToolView.swift

@@ -18,14 +18,15 @@ class TSLightShapeToolView: TSBaseView {
     
     var changedModelComplete:((TSLightItemModel)->Void)?
     
-    lazy var colorPickerView: TSLightShapePickerView = {
-        let colorPickerView = TSLightShapePickerView()
-        colorPickerView.dataArray = kLightShared.shapes
-        colorPickerView.selectedColorComplete = { [weak self] colorModel in
+    lazy var shapePickerView: TSLightShapePickerView = {
+        let shapePickerView = TSLightShapePickerView()
+        shapePickerView.dataArray = kLightShared.shapes
+        shapePickerView.layout.sectionInset = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16)
+        shapePickerView.selectedColorComplete = { [weak self] colorModel in
             guard let self = self else { return }
             changedModelComplete?(colorModel)
         }
-        return colorPickerView
+        return shapePickerView
     }()
 
     override func creatUI() {
@@ -38,18 +39,19 @@ class TSLightShapeToolView: TSBaseView {
             make.height.equalTo(6)
         }
         
-        addSubview(colorPickerView)
-        colorPickerView.snp.makeConstraints { make in
-            make.leading.equalTo(16)
-            make.trailing.equalTo(-16)
+        addSubview(shapePickerView)
+        shapePickerView.snp.makeConstraints { make in
+            make.leading.equalTo(0)
+            make.trailing.equalTo(0)
             make.top.equalTo(70)
             make.height.equalTo(40)
         }
+        
     }
     
     @objc func changedColor(slider: ColorSlider) {
         changedColorComplete?(slider.color)
-        colorPickerView.unCheck()
+        shapePickerView.unCheck()
     }
 }
 
@@ -97,7 +99,7 @@ class TSLightShapePickerView: TSBaseView {
         }
         
         kDelayMainShort {
-            self.collectionView.selectItem(at: self.currentIndexPath, animated: false, scrollPosition: .left)
+            self.collectionView.selectItem(at: self.currentIndexPath, animated: false, scrollPosition: .right)
         }
     }
     

+ 1 - 1
Girly/Business/TSTabBarController.swift

@@ -38,7 +38,7 @@ class TSTabBarController: UITabBarController {
         ]
         
         titleArray = [
-            "Lignt",
+            "Light",
             "Mirror",
             "Flash",
             "Setting"