소스 검색

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) {