소스 검색

feat:好评弹窗顺序

zhujieshan 4 주 전
부모
커밋
3ce503e28a

BIN
.DS_Store


+ 2 - 2
QuickSearchLocation.xcodeproj/project.pbxproj

@@ -1387,7 +1387,7 @@
 				CODE_SIGN_ENTITLEMENTS = QuickSearchLocation/QuickSearchLocationDebug.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 41;
+				CURRENT_PROJECT_VERSION = 42;
 				DEVELOPMENT_TEAM = Q364C8K9BL;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -1433,7 +1433,7 @@
 				CODE_SIGN_ENTITLEMENTS = QuickSearchLocation/QuickSearchLocationRelease.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 41;
+				CURRENT_PROJECT_VERSION = 42;
 				DEVELOPMENT_TEAM = Q364C8K9BL;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				FRAMEWORK_SEARCH_PATHS = (

+ 16 - 45
QuickSearchLocation/Classes/Common/Tool/QSLGuideusersToCommentManager.swift

@@ -15,7 +15,7 @@ enum QSLGuideusersToCommentType : Int{
 class QSLGuideusersToCommentManager: NSObject {
     
     static let commentShare = QSLGuideusersToCommentManager()
-    
+    var isClose = false
     //归因渠道
     public var clickCompanyChannel : String = ""
     
@@ -23,76 +23,47 @@ class QSLGuideusersToCommentManager: NSObject {
     var commentType: QSLGuideusersToCommentType = .member
     private var timer: Timer?
     
-    // Initialize and setup notifications
+    
+    var closeBtnClosure: (() -> ())?
+    
     override init() {
         super.init()
         setupAppStateNotifications()
-        startTimer()
     }
     
     deinit {
-        stopTimer()
         NotificationCenter.default.removeObserver(self)
     }
     
     // MARK: - Timer Management
     
     private func setupAppStateNotifications() {
-        NotificationCenter.default.addObserver(self,
-                                             selector: #selector(appDidEnterBackground),
-                                             name: UIApplication.didEnterBackgroundNotification,
-                                             object: nil)
-        NotificationCenter.default.addObserver(self,
-                                             selector: #selector(appWillEnterForeground),
-                                             name: UIApplication.willEnterForegroundNotification,
-                                             object: nil)
-    }
-    
-    @objc private func appWillEnterForeground() {
-        startTimer()
-    }
-    
-    @objc private func appDidEnterBackground() {
-        stopTimer()
+        NotificationCenter.default.addObserver(
+            self,
+            selector: #selector(windowDidBecomeKey),
+            name: UIWindow.didBecomeKeyNotification,
+            object: nil)
     }
-    
-    private func startTimer() {
-        //print("startTimersfsdf---A--\(self.commentType)")
-        // Invalidate existing timer if any
-        stopTimer()
-        
-        // Create new timer that fires every minute
-        timer = Timer.scheduledTimer(withTimeInterval: 60.0, repeats: true) { [weak self] _ in
-            self?.timerFired()
+            
+    @objc func windowDidBecomeKey(notification: Notification) {
+        if(self.isClose){
+            return
         }
-        
-        // Fire immediately on first start
-        timerFired()
-    }
-    
-    private func stopTimer() {
-        //print("startTimersfsdf---B--\(self.commentType)")
-        timer?.invalidate()
-        timer = nil
-    }
-    
-    private func timerFired() {
-        // Call your existing method here
-//        manageWhetherTriggerPopUpWindow(commentType)
+        self.closeBtnClosure?()
     }
     
     // MARK: - Existing Methods (unchanged)
     
     //管理处理是否触发好评引导弹窗
     func manageWhetherTriggerPopUpWindow(_ showType: QSLGuideusersToCommentType, closeBtnClosure: @escaping () -> () = {}) {
-        //print("startTimersfsdf---C--\(showType)---\(self.commentType)")
+        self.closeBtnClosure = closeBtnClosure
         QSLNetwork().request(.guideIsTriggered(dict: [String: Any]())) { response in
             let guideIsModel: QSLGuideIsTriggeredModel = response.mapObject(QSLGuideIsTriggeredModel.self, modelKey: "data")
             self.commentType = showType
             self.guideGobalModel = guideIsModel
             if guideIsModel.trigger{
                 DispatchQueue.main.async {
-                    self.noMemberPositiveReviewPopWindow(closeBtnClosure: closeBtnClosure)
+                    QSLInAppReviewmanager.requestReview()
                 }
             }else{
                 closeBtnClosure()

+ 4 - 0
QuickSearchLocation/Classes/Pages/QSLHome/Controller/QSLHomeController.swift

@@ -92,6 +92,10 @@ class QSLHomeController: QSLBaseController {
                             self?.checkLocAgain();
                         }
                     })
+                    
+                    DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
+                        QSLGuideusersToCommentManager.commentShare.isClose = true
+                    }
                 }
                 
             }