100Years 1 день тому
батько
коміт
b495b3681f

+ 0 - 8
TSSmalCoacopods/Classes/BaseClass/TSBaseCollectionCell.swift

@@ -70,14 +70,6 @@ open class TSBaseCollectionCell: UICollectionViewCell,TSComponentView  {
     }
     }
 }
 }
 
 
-extension TSBaseCollectionCell{
-
-}
-
-
-
-
-
 
 
 open class TSBaseCollectionnReusableView : UICollectionReusableView ,TSComponentView  {
 open class TSBaseCollectionnReusableView : UICollectionReusableView ,TSComponentView  {
     
     

+ 0 - 88
TSSmalCoacopods/Classes/BaseClass/TSBaseNavigationC.swift

@@ -9,17 +9,9 @@ import UIKit
 
 
 open class TSBaseNavigationC: UINavigationController, UIGestureRecognizerDelegate, UINavigationControllerDelegate, UINavigationBarDelegate {
 open class TSBaseNavigationC: UINavigationController, UIGestureRecognizerDelegate, UINavigationControllerDelegate, UINavigationBarDelegate {
 
 
-//    /// Whether to use system pop gesture. If false, full-screen pop gesture will be set.
-//    static let useSystemGesture: Bool = false
-//    /// Whether to enable global pop gestures. The default is true.
-//    static let popGestureEnabled: Bool = true
-//
-//    private var vcsDic: [String: Bool] = [:]
-
     open override func viewDidLoad() {
     open override func viewDidLoad() {
         super.viewDidLoad()
         super.viewDidLoad()
         configureNavigationBar()
         configureNavigationBar()
-//        configureNavigationGestures()
         view.backgroundColor = .clear
         view.backgroundColor = .clear
         interactivePopGestureRecognizer?.isEnabled = true;
         interactivePopGestureRecognizer?.isEnabled = true;
     }
     }
@@ -27,84 +19,4 @@ open class TSBaseNavigationC: UINavigationController, UIGestureRecognizerDelegat
     private func configureNavigationBar() {
     private func configureNavigationBar() {
         self.navigationBar.isHidden = true
         self.navigationBar.isHidden = true
     }
     }
-//
-//    private func configureNavigationGestures() {
-//        vcsDic = [:]
-//        self.interactivePopGestureRecognizer?.delegate = self
-//    }
-//
-//    // Override pushViewController to initialize interactive pop gesture here.
-//    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
-//        // Hide bottom bar only for the first pushed view controller
-//        viewController.hidesBottomBarWhenPushed = self.viewControllers.count == 1
-//        super.pushViewController(viewController, animated: animated)
-//        self.interactivePopGestureRecognizer?.isEnabled = TSBaseNavigationC.popGestureEnabled
-//    }
-//
-//    // MARK: - UIGestureRecognizerDelegate
-//
-//    func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
-//        // Disable pop gesture if it's the root view controller
-//        if self.viewControllers.count == 1 {
-//            return false
-//        }
-//        let vcKey = vcKeyFromVC(self.topViewController)
-//        if let vcKey = vcKey, let isEnabled = vcsDic[vcKey] {
-//            return isEnabled
-//        }
-//        return self.interactivePopGestureRecognizer?.isEnabled ?? true
-//    }
-//
-//    // MARK: - UINavigationControllerDelegate
-//
-//    func navigationController(_ navigationController: UINavigationController,
-//                              willShow viewController: UIViewController,
-//                              animated: Bool) {
-//        if #available(iOS 10.0, *) {
-//            viewController.transitionCoordinator?.notifyWhenInteractionChanges { context in
-//                if context.isCancelled { return }
-//                debugPrint("notifyWhenInteractionChanges context.isCancelled=\(context.isCancelled)")
-//            }
-//        }
-//    }
-//
-//    func navigationController(_ navigationController: UINavigationController,
-//                              didShow viewController: UIViewController,
-//                              animated: Bool) {
-//        let vcKey = vcKeyFromVC(viewController)
-//        if let vcKey = vcKey, vcsDic[vcKey] == nil {
-//            // Save pop gesture enabled value for each child view controller
-//            vcsDic[vcKey] = self.interactivePopGestureRecognizer?.isEnabled ?? true
-//        }
-//    }
-//
-//    // MARK: - UINavigationBarDelegate
-//
-//    func navigationBar(_ navigationBar: UINavigationBar, shouldPop item: UINavigationItem) -> Bool {
-//        return true
-//    }
-//
-//    // MARK: - Convenience Methods
-//
-//    private func vcKeyFromVC(_ viewController: UIViewController?) -> String? {
-//        guard let viewController = viewController else { return nil }
-//        return String(describing: type(of: viewController))
-//    }
-//
-//    func setSpecifiedViewControllerInteractivePopGestureEnabled(_ enabled: Bool) {
-//        let vcKey = vcKeyFromVC(self.topViewController)
-//        if let vcKey = vcKey {
-//            vcsDic[vcKey] = enabled
-//        }
-//    }
-//
-//    // MARK: - Status Bar
-//
-//    override var childForStatusBarStyle: UIViewController? {
-//        return self.topViewController
-//    }
-//
-//    deinit {
-////        debugPrint("TGRootNavigationController deinitialized")
-//    }
 }
 }

+ 1 - 1
TSSmalCoacopods/Classes/Config/TSColorConfig.swift

@@ -10,7 +10,7 @@ public let TSColorConfigShared = TSColorConfig.shared
 open class TSColorConfig {
 open class TSColorConfig {
     static var shared = TSColorConfig()
     static var shared = TSColorConfig()
     /// 背景色
     /// 背景色
-    public var mainBg:UIColor = "#111111".uiColor
+    public var mainBg:UIColor = "#010101".uiColor
     /// 主色调
     /// 主色调
     public var themeColor = "#FF54C6".uiColor
     public var themeColor = "#FF54C6".uiColor
     
     

+ 4 - 1
TSSmalCoacopods/Classes/Ex/UIFont+Ex.swift

@@ -17,9 +17,12 @@ public extension UIFont {
         guard !name.isEmpty,
         guard !name.isEmpty,
                 let _ = UIFont(name: name, size: size) else {
                 let _ = UIFont(name: name, size: size) else {
             return UIFont.systemFont(ofSize: size, weight: weight)
             return UIFont.systemFont(ofSize: size, weight: weight)
+            
         }
         }
-        var finalFontName = name
         
         
+        
+        var finalFontName = name
+//        print("FontName name = \(name)")
         let fontNames = UIFont.fontNames(forFamilyName: name)
         let fontNames = UIFont.fontNames(forFamilyName: name)
         switch weight {
         switch weight {
         case .light://细体 300
         case .light://细体 300

+ 127 - 8
TSSmalCoacopods/Classes/Ex/UIImageView+Ex.swift

@@ -89,15 +89,22 @@ public extension UIImageView {
     
     
     public func setAsyncImage(urlString: String?,
     public func setAsyncImage(urlString: String?,
                      placeholder: UIImage? = nil,
                      placeholder: UIImage? = nil,
-                     contentMode: UIView.ContentMode = .scaleAspectFit,
+                     contentMode: UIView.ContentMode? = nil,
                  adaptiveMode:Bool = false,
                  adaptiveMode:Bool = false,
-                 backgroundColor: UIColor = .clear,
+                 backgroundColor: UIColor? = nil,
                       showLoading: Bool = false,
                       showLoading: Bool = false,
                         progressBlock: ((Float)->Void)? = nil,
                         progressBlock: ((Float)->Void)? = nil,
                       completion: ((UIImage?) -> Void)? = nil){
                       completion: ((UIImage?) -> Void)? = nil){
         let imageView = self
         let imageView = self
-        imageView.contentMode = contentMode
-        imageView.backgroundColor = backgroundColor
+        
+        if let contentMode = contentMode {
+            imageView.contentMode = contentMode
+        }
+        
+        if let backgroundColor = backgroundColor {
+            imageView.backgroundColor = backgroundColor
+        }
+ 
         imageView.image = placeholder
         imageView.image = placeholder
         
         
         guard let urlString = urlString else {
         guard let urlString = urlString else {
@@ -150,7 +157,7 @@ public extension UIImageView {
     
     
     static public func createRightArrow() -> UIImageView {
     static public func createRightArrow() -> UIImageView {
         let imageView = UIImageView()
         let imageView = UIImageView()
-        imageView.image = UIImage(named: "white_right_arrow")
+        imageView.image = UIImage(named: "gray_right_arrow")
         return imageView
         return imageView
     }
     }
     
     
@@ -193,31 +200,144 @@ public extension UIImageView {
     static func retrieveImageInMemoryCache(urlString: String) -> UIImage? {
     static func retrieveImageInMemoryCache(urlString: String) -> UIImage? {
         return ImageCache.default.retrieveImageInMemoryCache(forKey: urlString)
         return ImageCache.default.retrieveImageInMemoryCache(forKey: urlString)
     }
     }
+
+    static func storeImage(image:UIImage,urlString: String){
+        if let url = URL(string: urlString){
+            ImageCache.default.store(image, forKey: url.cacheKey)
+        }
+    }
+
+    
+    static func removeImage(urlString: String){
+        if let url = URL(string: urlString){
+            ImageCache.default.removeImage(forKey: url.cacheKey)
+        }
+    }
+    
+//    static func downloadImageWithProgress(
+//        urlString: String,
+//        progressHandler: ((Float) -> Void)? = nil,
+//        completion: @escaping (UIImage?) -> Void
+//    ) {
+//
+//
+//        
+//        if urlString.contains("http") {
+//            guard let url = URL(string: urlString) else {
+//                completion(nil)
+//                return
+//            }
+//            
+//            KingfisherManager.shared.retrieveImage(
+//                with: url,
+//                options: [],
+//                progressBlock: { receivedSize, totalSize in
+//                    let progress = Float(receivedSize) / Float(totalSize)
+//                    DispatchQueue.main.async {
+//                        progressHandler?(progress) // 回传进度(主线程)
+//                    }
+//                },
+//                completionHandler: { result in
+//                    DispatchQueue.main.async {
+//                        switch result {
+//                        case .success(let value):
+//                            completion(value.image)
+//                        case .failure:
+//                            completion(nil)
+//                        }
+//                    }
+//                }
+//            )
+//        }else if urlString.contains("/") {
+//            completion(UIImage(contentsOfFile: urlString.fillCachePath))
+//        }else {
+//            if let image = UIImage(named: urlString) {
+//                completion(image)
+//            }
+//        }
+//        
+//
+//    }
+    
+    
+    
     
     
     static func downloadImageWithProgress(
     static func downloadImageWithProgress(
         urlString: String,
         urlString: String,
         progressHandler: ((Float) -> Void)? = nil,
         progressHandler: ((Float) -> Void)? = nil,
         completion: @escaping (UIImage?) -> Void
         completion: @escaping (UIImage?) -> Void
     ) {
     ) {
-
+        // 处理非HTTP URL的情况
+        if !urlString.contains("http") {
+            handleLocalImage(urlString: urlString, completion: completion)
+            return
+        }
+        
         guard let url = URL(string: urlString) else {
         guard let url = URL(string: urlString) else {
             completion(nil)
             completion(nil)
             return
             return
         }
         }
         
         
+        let cacheKey = url.cacheKey
+        
+        // 1. 首先尝试从内存缓存获取
+        if let memoryImage = ImageCache.default.retrieveImageInMemoryCache(forKey: cacheKey) {
+            completion(memoryImage)
+            return
+        }
+        
+        // 2. 然后尝试从磁盘缓存获取
+        ImageCache.default.retrieveImage(forKey: cacheKey) { result in
+            switch result {
+            case .success(let value):
+                if let diskImage = value.image {
+                    // 将从磁盘获取的图片存入内存缓存
+                    ImageCache.default.store(diskImage, forKey: cacheKey, toDisk: false)
+                    DispatchQueue.main.async {
+                        completion(diskImage)
+                    }
+                    return
+                }
+                
+                // 3. 如果缓存中没有,则从网络下载
+                downloadFromNetwork(url: url, cacheKey: cacheKey, progressHandler: progressHandler, completion: completion)
+                
+            case .failure:
+                // 如果磁盘缓存获取失败,也尝试从网络下载
+                downloadFromNetwork(url: url, cacheKey: cacheKey, progressHandler: progressHandler, completion: completion)
+            }
+        }
+    }
+
+    private static func handleLocalImage(urlString: String, completion: @escaping (UIImage?) -> Void) {
+        if urlString.contains("/") {
+            completion(UIImage(contentsOfFile: urlString.fillCachePath))
+        } else {
+            completion(UIImage(named: urlString))
+        }
+    }
+
+    private static func downloadFromNetwork(
+        url: URL,
+        cacheKey: String,
+        progressHandler: ((Float) -> Void)?,
+        completion: @escaping (UIImage?) -> Void
+    ) {
         KingfisherManager.shared.retrieveImage(
         KingfisherManager.shared.retrieveImage(
             with: url,
             with: url,
             options: [],
             options: [],
             progressBlock: { receivedSize, totalSize in
             progressBlock: { receivedSize, totalSize in
                 let progress = Float(receivedSize) / Float(totalSize)
                 let progress = Float(receivedSize) / Float(totalSize)
                 DispatchQueue.main.async {
                 DispatchQueue.main.async {
-                    progressHandler?(progress) // 回传进度(主线程)
+                    progressHandler?(progress)
                 }
                 }
             },
             },
             completionHandler: { result in
             completionHandler: { result in
                 DispatchQueue.main.async {
                 DispatchQueue.main.async {
                     switch result {
                     switch result {
                     case .success(let value):
                     case .success(let value):
+                        // 将下载的图片存入缓存
+                        ImageCache.default.store(value.image, forKey: cacheKey)
                         completion(value.image)
                         completion(value.image)
                     case .failure:
                     case .failure:
                         completion(nil)
                         completion(nil)
@@ -227,5 +347,4 @@ public extension UIImageView {
         )
         )
     }
     }
     
     
-    
 }
 }

+ 9 - 0
TSSmalCoacopods/Classes/Ex/UIView+Rotating.swift

@@ -71,3 +71,12 @@ public extension UIView {
         self.alpha = 1.0 // 恢复到默认状态
         self.alpha = 1.0 // 恢复到默认状态
     }
     }
 }
 }
+
+public extension UIView {
+    /// 设置绝对旋转角度
+    ///   - angle: 旋转角度(度数)
+    func setRotation(angle: CGFloat) {
+        let radians = angle * .pi / 180
+        self.transform = CGAffineTransform(rotationAngle: radians)
+    }
+}

+ 394 - 0
TSSmalCoacopods/Classes/Tool/CpuMapManager.swift

@@ -0,0 +1,394 @@
+//
+//  CpuMapManager.swift
+//  Pods
+//
+//  Created by 100Years on 2025/6/10.
+//
+
+import UIKit
+
+public class CpuMapManager: NSObject {
+    static let shared = CpuMapManager()
+    
+    /// 数据来源 https://kylebing.cn/tools/iphone/
+    ///         http://kylebing.cn/tools/iphone/
+    ///
+    private let deviceMap: [String: [String: String]] = [
+        
+        "iPhone 16 Pro Max" : ["CPU":"A18 Pro",
+                               "Freq": "4.04GHz",
+                               "Battery": "4685 mah"],
+        "iPhone 16 Pro"     : ["CPU":"A18 Pro",
+                               "Freq": "4.04GHz",
+                               "Battery": "3582 mah"],
+        "iPhone 16 Plus"    : ["CPU":"A18",
+                               "Freq": "3.78GHz",
+                               "Battery": "4674 mah"],
+        "iPhone 16"         : ["CPU":"A18",
+                               "Freq": "3.78GHz",
+                               "Battery": "3561 mah"],
+        
+        "iPhone 15 Pro Max" : ["CPU":"A17 Pro",
+                               "Freq": "3.77GHz",
+                               "Battery": "4422 mah"],
+        "iPhone 15 Pro"     : ["CPU":"A17 Pro",
+                               "Freq": "3.77GHz",
+                               "Battery": "3274 mah"],
+        "iPhone 15 Plus"    : ["CPU":"A16",
+                               "Freq": "3.46GHz",
+                               "Battery": "4383 mah"],
+        "iPhone 15"         : ["CPU":"A16",
+                               "Freq": "3.46GHz",
+                               "Battery": "3349 mah"],
+        
+        "iPhone 14 Pro Max" : ["CPU":"A16",
+                               "Freq": "3.46GHz",
+                               "Battery": "4323 mah"],
+        "iPhone 14 Pro"     : ["CPU":"A16",
+                               "Freq": "3.46GHz",
+                               "Battery": "3200 mah"],
+        "iPhone 14 Plus"    : ["CPU":"A15",
+                               "Freq": "3.20GHz",
+                               "Battery": "4325 mah"],
+        "iPhone 14"         : ["CPU":"A15",
+                               "Freq": "3.20GHz",
+                               "Battery": "3279 mah"],
+        
+        "iPhone SE3"        : ["CPU":"A15",
+                               "Freq": "3.20GHz",
+                               "Battery": "2018 mah"],
+        "iPhone 13 Pro Max" : ["CPU":"A15",
+                               "Freq": "3.20GHz",
+                               "Battery": "4352 mah"],
+        "iPhone 13 Pro"     : ["CPU":"A15",
+                               "Freq": "3.20GHz",
+                               "Battery": "3095 mah"],
+        "iPhone 13"         : ["CPU":"A15",
+                               "Freq": "3.20GHz",
+                               "Battery": "3227 mah"],
+        "iPhone 13 Mini"    : ["CPU":"A15",
+                               "Freq": "3.20GHz",
+                               "Battery": "2406 mah"],
+        
+        "iPhone 12 Pro Max" : ["CPU":"A14",
+                               "Freq": "3.00GHz",
+                               "Battery": "3687 mah"],
+        "iPhone 12 Pro"     : ["CPU":"A14",
+                               "Freq": "3.00GHz",
+                               "Battery": "2815 mah"],
+        "iPhone 12"         : ["CPU":"A14",
+                               "Freq": "3.00GHz",
+                               "Battery": "2851 mah"],
+        "iPhone 12 Mini"    : ["CPU":"A14",
+                               "Freq": "3.00GHz",
+                               "Battery": "2227 mah"],
+        
+        "iPhone SE2"        : ["CPU":"A13",
+                               "Freq": "2.0GHz",
+                               "Battery": "1821 mah"],
+        
+        "iPhone 11 Pro Max" : ["CPU":"A13",
+                               "Freq": "2.0GHz",
+                               "Battery": "3969 mah"],
+        "iPhone 11 Pro"     : ["CPU":"A13",
+                               "Freq": "2.0GHz",
+                               "Battery": "3046 mah"],
+        "iPhone 11"         : ["CPU":"A13",
+                               "Freq": "2.0GHz",
+                               "Battery": "3110 mah"],
+        
+        "iPhone XR"         : ["CPU":"A13",
+                               "Freq": "2.0GHz",
+                               "Battery": "2942 mah"],
+        "iPhone XS Max"     : ["CPU":"A12",
+                               "Freq": "2.49GHz",
+                               "Battery": "3174 mah"],
+        "iPhone XS"         : ["CPU":"A12",
+                               "Freq": "2.49GHz",
+                               "Battery": "2658 mah"],
+        "iPhone X"          : ["CPU":"A11",
+                               "Freq": "1.4GHz",
+                               "Battery": "2716 mah"],
+        
+        "iPhone 8 Plus"     : ["CPU":"A11",
+                               "Freq": "1.4GHz",
+                               "Battery": "2691 mah"],
+        "iPhone 8"          : ["CPU":"A11",
+                               "Freq": "1.4GHz",
+                               "Battery": "1821 mah"],
+        "iPhone 7 Plus"     : ["CPU":"A11",
+                               "Freq": "1.4GHz",
+                               "Battery": "2900 mah"],
+        "iPhone 7"          : ["CPU":"A10",
+                               "Freq": "1.3GHz",
+                               "Battery": "1960 mah"],
+        "iPhone SE"         : ["CPU":"A9",
+                               "Freq": "1.85GHz",
+                               "Battery": "1624 mah"],
+        "iPhone 6s Plus"    : ["CPU":"A9",
+                               "Freq": "1.85GHz",
+                               "Battery": "2750 mah"],
+        "iPhone 6s"         : ["CPU":"A9",
+                               "Freq": "1.85GHz",
+                               "Battery": "1715 mah"],
+    ]
+    
+    private(set) var modelName: String
+    private(set) var cpuName: String?
+    /// CPU频率
+    private(set) var cpuFreq: String?
+    private(set) var batteryCapacity: String?
+    
+    override init() {
+        
+        modelName = UIDevice.current.modelName
+        cpuName = deviceMap[modelName]?["CPU"]
+        cpuFreq = deviceMap[modelName]? ["Freq"]
+        batteryCapacity = deviceMap[modelName]?["Battery"]
+        
+        super.init()
+    }
+}
+
+extension UIDevice {
+    
+    var modelIdentifier: String {
+        var systemInfo = utsname()
+        uname(&systemInfo)
+        
+        let machineMirror = Mirror(reflecting: systemInfo.machine)
+        let identifier = machineMirror.children.reduce("") { (identifier, element) in
+            guard let value = element.value as? Int8, value != 0 else {
+                return identifier
+            }
+            return identifier + String(UnicodeScalar(UInt8(value)))
+        }
+        
+        return identifier
+    }
+    
+    /// 数据来源 https://www.jianshu.com/p/d9068fee295e
+    public var modelName: String {
+        
+        let identifier = modelIdentifier
+        
+        switch identifier {
+        case "iPhone8,1":
+            return "iPhone 6s"
+        case "iPhone8,2":
+            return "iPhone 6s Plus"
+        case "iPhone8,4":
+            return "iPhone SE"
+        case "iPhone9,1":
+            return "iPhone 7"; //国行、日版、港行
+        case "iPhone9,2":
+            return "iPhone 7 Plus"; //国行、港行
+        case "iPhone9,3":
+            return "iPhone 7"; //美版、台版
+        case "iPhone9,4":
+            return "iPhone 7 Plus"; //美版、台版
+        case "iPhone10,1":
+            return "iPhone 8"; //国行(A1863)、日行(A1906)
+        case "iPhone10,2":
+            return "iPhone 8 Plus"; //国行(A1864)、日行(A1898)
+        case "iPhone10,3":
+            return "iPhone X"; //国行(A1865)、日行(A1902)
+        case "iPhone10,4":
+            return "iPhone 8"; //美版(Global/A1905)
+        case "iPhone10,5":
+            return "iPhone 8 Plus"; //美版(Global/A1897)
+        case "iPhone10,6":
+            return "iPhone X";//美版(Global/A1901)
+            
+        // 刘海屏(除SE外)
+        case "iPhone11,8":
+            return "iPhone XR"
+        case "iPhone11,2":
+            return "iPhone XS"
+        case "iPhone11,6":
+            return "iPhone XS Max"
+        case "iPhone11,4":
+            return "iPhone XS Max"
+        case "iPhone12,1":
+            return "iPhone 11"
+        case "iPhone12,3":
+            return "iPhone 11 Pro"
+        case "iPhone12,5":
+            return "iPhone 11 Pro Max"
+        case "iPhone12,8":
+            return "iPhone SE2"; //(2nd generation)
+        case "iPhone13,1":
+            return "iPhone 12 mini"
+        case "iPhone13,2":
+            return "iPhone 12"
+        case "iPhone13,3":
+            return "iPhone 12 Pro"
+        case "iPhone13,4":
+            return "iPhone 12 Pro Max"
+        case "iPhone14,2":
+            return "iPhone 13 Pro"
+        case "iPhone14,3":
+            return "iPhone 13 Pro Max"
+        case "iPhone14,4":
+            return "iPhone 13 mini"
+        case "iPhone14,5":
+            return "iPhone 13"
+        case "iPhone14,6":
+            return "iPhone SE3"; //(2nd generation)
+        case "iPhone14,7":
+            return "iPhone 14"
+        case "iPhone14,8":
+            return "iPhone 14 Plus"
+            
+        // 灵动岛
+        case "iPhone15,2":
+            return "iPhone 14 Pro"
+        case "iPhone15,3":
+            return "iPhone 14 Pro Max"
+            
+        case "iPhone16,2":
+            return "iPhone 15 Pro Max"
+        case "iPhone16,1":
+            return "iPhone 15 Pro"
+        case "iPhone15,5":
+            return "iPhone 15 Plus"
+        case "iPhone15,4":
+            return "iPhone 15"
+
+            
+        case "iPhone17,3":
+            return "iPhone 16"
+        case "iPhone17,4":
+            return "iPhone 16 Plus"
+        case "iPhone17,1":
+            return "iPhone 16 Pro"
+        case "iPhone17,2":
+            return "iPhone 16 Pro Max"
+            
+            
+            
+        default:
+            return "--"
+        }
+    }
+    
+    var currentSysVersion: Int {
+        let version = UIDevice.current.systemVersion
+        let v1 = version.components(separatedBy: ".").first ?? "0"
+        let doubleVersion = Double(v1)
+        if let doubleVersion = doubleVersion {
+            return Int(doubleVersion)
+        }
+        return 0
+    }
+    
+    // 版本判断
+    func currentSysVersionEqualOrGreater(than version: String) -> Bool {
+        var sysValues = UIDevice.current.systemVersion.components(separatedBy: ".")
+        var values = version.components(separatedBy: ".")
+        
+        // 位数不同,少的补0
+        let count = max(sysValues.count, values.count)
+        if sysValues.count < count {
+            let more = Array(repeating: "0", count: count-sysValues.count)
+            sysValues.append(contentsOf: more)
+        }
+        if values.count < count {
+            let more = Array(repeating: "0", count: count-values.count)
+            values.append(contentsOf: more)
+        }
+        
+        for idx in 0..<count {
+            if let sv = Int(sysValues.safeObj(At: idx) ?? "0"),
+                let v = Int(values.safeObj(At: idx) ?? "0") {
+                if sv > v {
+                    return true
+                } else if sv < v {
+                    return false
+                }
+            }
+        }
+        return true
+    }
+    
+    var iPhoneXids: [String] {
+        return ["iPhone10,3", "iPhone10,6"]
+    }
+    
+    var iPhoneSEids: [String] {
+        return ["iPhone8,4", "iPhone12,8", "iPhone14,6"]
+    }
+}
+
+// 传感器样式: 无 | 刘海 | 灵动岛
+enum DeviceSensorStyle {
+    case none
+    case bang
+    case island
+}
+
+extension UIDevice {
+    func sensorStyle() -> DeviceSensorStyle {
+#if targetEnvironment(simulator)
+        return .island
+#endif
+        let identifier = UIDevice.current.modelIdentifier
+        // SE
+        if iPhoneSEids.contains(identifier) {
+            return .none
+        }
+        // X
+        if iPhoneXids.contains(identifier) {
+            return .bang
+        }
+        if identifier.hasPrefix("iPhone") {
+            let digital = identifier.replacingOccurrences(of: "iPhone", with: "")
+            let arr = digital.components(separatedBy: ",")
+            if let v1 = arr.safeObj(At: 0),
+               let vv1 = Double(v1) {
+                if vv1 >= 15 {
+                    return .island
+                } else {
+                    if vv1 < 11 {
+                        return .none
+                    }
+                    return .bang
+                }
+            }
+        }
+        return .none
+    }
+    
+    // 刘海屏 及以后设备才可以升级到16.1
+    var supportLiveActivity: Bool {
+        guard #available(iOS 16.1, *) else {
+            return false
+        }
+        let style = sensorStyle()
+        return style != .none
+    }
+    
+    var sensorSize: CGSize {
+        let style = sensorStyle()
+        switch style {
+        case .none:
+            return .zero
+        case .bang:
+            let ratio: CGFloat = UIScreen.main.bounds.width/375.0
+            return CGSize(width: 219*ratio, height: 30*ratio)
+        case .island:
+            return CGSize(width: 125, height: 36.7)//16s 和 16sp 是 126*37.3
+        }
+    }
+    
+    var sensorTop:Double{
+        let kScreenWidth = UIScreen.main.bounds.size.width
+        let kScreenHeight = UIScreen.main.bounds.size.height
+        //16s和 16sp
+        if (kScreenWidth == 440 && kScreenHeight == 956) || (kScreenWidth == 402 && kScreenHeight == 874) ||  modelName.contains("iPhone 16 Pro") {
+            return 14.0
+        } else {
+            return 11.3
+        }
+    }
+}

+ 1 - 1
TSSmalCoacopods/Classes/View/TSSaveSuccessTool/TSSaveSuccessTool.swift

@@ -114,7 +114,7 @@ open class TSSaveSuccessTool {
                 make.width.lessThanOrEqualTo(k_ScreenWidth-32)
                 make.width.lessThanOrEqualTo(k_ScreenWidth-32)
                 make.height.equalTo(48)
                 make.height.equalTo(48)
                 make.centerX.equalToSuperview()
                 make.centerX.equalToSuperview()
-                make.bottom.equalTo(bottom)
+                make.top.equalTo(k_Nav_Height + 10)
             }
             }
         }
         }