Browse Source

add NCViewerMedia.swift

Marino Faggiana 6 years ago
parent
commit
8a404c1995
1 changed files with 28 additions and 0 deletions
  1. 28 0
      iOSClient/Viewer/NCViewerMedia.swift

+ 28 - 0
iOSClient/Viewer/NCViewerMedia.swift

@@ -114,4 +114,32 @@ class NCViewerMedia: NSObject {
             self.viewDetail.buttonAction.isEnabled = true
         }
     }
+    
+    @objc func setupHTTPCache() {
+        
+        var error: NSError?
+
+        KTVHTTPCache.cacheSetMaxCacheLength(Int64(k_maxHTTPCache))
+        
+        if ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"] != nil {
+            KTVHTTPCache.logSetConsoleLogEnable(true)
+        }
+        
+        KTVHTTPCache.proxyStart(&error)
+        if error == nil {
+            print("Proxy Start Success")
+        } else {
+            print("Proxy Start error : \(error!)")
+        }
+    
+        KTVHTTPCache.tokenSetURLFilter { (url) -> URL? in
+            print("URL Filter reviced URL : \(url!)")
+            return url
+        }
+        
+        KTVHTTPCache.downloadSetUnsupportContentTypeFilter { (url, contentType) -> Bool in
+            print("Unsupport Content-Type Filter reviced URL : \(url!) \(contentType!)")
+            return false
+        }
+    }
 }