Răsfoiți Sursa

test

Signed-off-by: marinofaggiana <marino@marinofaggiana.com>
marinofaggiana 3 ani în urmă
părinte
comite
6be6fd451b

+ 0 - 3
iOSClient/AppDelegate.swift

@@ -314,9 +314,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         // close detail
         NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterMenuDetailClose)
         
-        // Video proxy
-        NCKTVHTTPCache.shared.restartProxy(user: user, password: password)
-
         // Registeration domain File Provider
         //FileProviderDomain *fileProviderDomain = [FileProviderDomain new];
         //[fileProviderDomain removeAllDomains];

+ 11 - 11
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCKTVHTTPCache.swift

@@ -45,7 +45,16 @@ class NCKTVHTTPCache: NSObject {
         }
     }
     
-    func startProxy(user: String, password: String) {
+    func restartProxy(user: String, password: String) {
+                
+        if KTVHTTPCache.proxyIsRunning() {
+            KTVHTTPCache.proxyStop()
+        }
+        
+        startProxy(user: user, password: password)
+    }
+    
+    private func startProxy(user: String, password: String) {
         
         guard let authData = (user + ":" + password).data(using: .utf8) else { return }
         
@@ -61,22 +70,13 @@ class NCKTVHTTPCache: NSObject {
         }        
     }
     
-    func stopProxy() {
+    private func stopProxy() {
         
         if KTVHTTPCache.proxyIsRunning() {
             KTVHTTPCache.proxyStop()
         }
     }
     
-    func restartProxy(user: String, password: String) {
-                
-        if KTVHTTPCache.proxyIsRunning() {
-            KTVHTTPCache.proxyStop()
-        }
-        
-        startProxy(user: user, password: password)
-    }
-    
     func getProxyURL(stringURL: String) -> URL {
         
         return KTVHTTPCache.proxyURL(withOriginalURL: URL(string: stringURL))

+ 2 - 1
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -144,6 +144,8 @@ class NCViewerMedia: UIViewController {
         
         if (metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue) {
             
+            NCKTVHTTPCache.shared.restartProxy(user: appDelegate.user, password: appDelegate.password)
+            
             if ncplayer == nil, let url = NCKTVHTTPCache.shared.getVideoURL(metadata: metadata) {
                 self.ncplayer = NCPlayer.init(url: url, autoPlay: self.autoPlay, imageVideoContainer: self.imageVideoContainer, playerToolBar: self.playerToolBar, metadata: self.metadata, detailView: self.detailView)
             } else {
@@ -235,7 +237,6 @@ class NCViewerMedia: UIViewController {
             } else {
                 
                 let image = getImageMetadata(metadata)
-                
                 DispatchQueue.main.async { completion(metadata.ocId, image) }
             }
         }