Browse Source

【综合】远程逻辑新增DFP点击跳转比较表

wanjun 4 months ago
parent
commit
9ea3e293ad

+ 10 - 4
PDF Office/PDF Master/Class/AD/KMAdsWebView.swift

@@ -292,11 +292,17 @@ class KMAdsWebView: NSView, WKNavigationDelegate, CAAnimationDelegate {
         guard let string = self.adsInfo?.adsURLLink else {
             return
         }
+        guard let type = self.adsInfo?.jumpType else {
+            return
+        }
+        
+        if type == .ComparisonSheet {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        } else {
+            let newURL = NSURL(string: string)
+            NSWorkspace.shared.open(newURL! as URL)
+        }
         
-        let newURL = NSURL(string: string)
-
-        NSWorkspace.shared.open(newURL! as URL)
-
         if let completionHandler = self.completionHandler {
             completionHandler(currentPage + 1)
         }

+ 21 - 1
PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/KMAdsInfo.swift

@@ -7,6 +7,11 @@
 
 import Cocoa
 
+enum KMDFPJumpType: Int {
+    case Web = 0            // 网页
+    case ComparisonSheet    // 比较表
+}
+
 @objcMembers class KMAdsInfoManager: NSObject {
     
     public static let shareInstance = KMAdsInfoManager.init()
@@ -133,7 +138,22 @@ import Cocoa
         return self.infoDict["version"] as! String
     }
     
-    
+    var jumpType: KMDFPJumpType {
+        get {
+            guard let typeString = self.infoDict.object(forKey: "jumpType") else {
+                return .Web
+            }
+            if typeString is String {
+                let jumpTypeString = typeString as! String
+                if jumpTypeString == "Comparison Sheet" {
+                    return .ComparisonSheet
+                } else if jumpTypeString == "Web" {
+                    return .Web
+                }
+            }
+            return .Web
+        }
+    }
 }