Kaynağa Gözat

don't works HYPERLINK

marinofaggiana 4 yıl önce
ebeveyn
işleme
5abbc86b23
1 değiştirilmiş dosya ile 9 ekleme ve 0 silme
  1. 9 0
      iOSClient/Viewer/NCViewerRichdocument.swift

+ 9 - 0
iOSClient/Viewer/NCViewerRichdocument.swift

@@ -191,6 +191,15 @@ class NCViewerRichdocument: WKWebView, WKNavigationDelegate, WKScriptMessageHand
             if message.body as? String == "paste" {
                 self.paste(self)
             }
+            
+            if (message.body as? String)?.hasPrefix("HYPERLINK") != nil {
+                if let messageBodyItem = (message.body as? String)?.components(separatedBy: " ") {
+                    if messageBodyItem.count >= 2 {
+                        let url = URL(fileURLWithPath: messageBodyItem[1])
+                        UIApplication.shared.open(url, options: [:]) { (_) in }
+                    }
+                }
+            }
         }
     }