Browse Source

new user agent for OnlyOffice integration

marinofaggiana 5 years ago
parent
commit
479e57cb35
1 changed files with 8 additions and 3 deletions
  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) {