File tree Expand file tree Collapse file tree
owncloud/android/ui/activity Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,4 +27,10 @@ class EditorUtils @Inject constructor(private val arbitraryDataProvider: Arbitra
2727 }
2828
2929 fun isEditorAvailable (user : User ? , mimeType : String? ): Boolean = getEditor(user, mimeType) != null
30+
31+ fun usesOfficeUserAgent (editor : Editor ? ): Boolean = editor?.id in OFFICE_EDITOR_IDS
32+
33+ companion object {
34+ private val OFFICE_EDITOR_IDS = setOf (" onlyoffice" , " eurooffice" )
35+ }
3036}
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ class TextEditorWebView : EditorWebView() {
4545
4646 val editor = editorUtils.getEditor(user.get(), file?.mimeType)
4747
48- if (editor != null && editor.id == " onlyoffice " ) {
49- webView.settings.userAgentString = generateOnlyOfficeUserAgent ()
48+ if (editorUtils.usesOfficeUserAgent(editor) ) {
49+ webView.settings.userAgentString = generateOfficeUserAgent ()
5050 }
5151
5252 webView.addJavascriptInterface(MobileInterface (), " DirectEditingMobileInterface" )
@@ -72,8 +72,8 @@ class TextEditorWebView : EditorWebView() {
7272 }
7373 }
7474
75- private fun generateOnlyOfficeUserAgent (): String {
76- val userAgent = applicationContext.resources.getString(R .string.only_office_user_agent )
75+ private fun generateOfficeUserAgent (): String {
76+ val userAgent = applicationContext.resources.getString(R .string.office_user_agent )
7777
7878 return String .format(userAgent, deviceInfo.androidVersion, appInfo.getAppVersion(this ))
7979 }
Original file line number Diff line number Diff line change 2424 <string name =" data_folder" >nextcloud</string >
2525 <string name =" default_display_name_for_root_folder" >Nextcloud</string >
2626 <string name =" nextcloud_user_agent" >Mozilla/5.0 (Android) Nextcloud-android/%1$s%2$s</string >
27- <string name =" only_office_user_agent " >Mozilla/5.0 (Android %1$s) Mobile Nextcloud-android/%2$s</string >
27+ <string name =" office_user_agent " >Mozilla/5.0 (Android %1$s) Mobile Nextcloud-android/%2$s</string >
2828 <string name =" name_for_branded_user_agent" ></string >
2929
3030 <!-- URLs and flags related -->
You can’t perform that action at this time.
0 commit comments