Преглед на файлове

new user agent for OnlyOffice integration

marinofaggiana преди 5 години
родител
ревизия
479e57cb35
променени са 1 файла, в които са добавени 8 реда и са изтрити 3 реда
  1. 8 3
      iOSClient/Viewer/NCViewerNextcloudText.swift

+ 8 - 3
iOSClient/Viewer/NCViewerNextcloudText.swift

@@ -61,9 +61,14 @@ class NCViewerNextcloudText: WKWebView, WKNavigationDelegate, WKScriptMessageHan
         let language = NSLocale.preferredLanguages[0] as String
         request.addValue(language, forHTTPHeaderField: "Accept-Language")
         
-        let userAgent : String = CCUtility.getUserAgent()
-        customUserAgent = userAgent
-        load(request)        
+        let appVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString")!
+        if UIDevice.current.userInterfaceIdiom == .pad {
+            customUserAgent = "Mozilla/5.0 (iOS) Nextcloud-iOS/\(appVersion)"
+        }else{
+            customUserAgent = "Mozilla/5.0 (iOS) Mobile Nextcloud-iOS/\(appVersion)"
+        }
+                
+        load(request)
     }
     
     @objc func keyboardDidShow(notification: Notification) {