Skip to content

Commit bc893a1

Browse files
committed
fix: use office user agent for all office direct editing editors
Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
1 parent f8fb1f2 commit bc893a1

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

app/src/main/java/com/nextcloud/utils/EditorUtils.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

app/src/main/java/com/owncloud/android/ui/activity/TextEditorWebView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class TextEditorWebView : EditorWebView() {
4545

4646
val editor = editorUtils.getEditor(user.get(), file?.mimeType)
4747

48-
if (editor != null && editor.id == "onlyoffice") {
48+
if (editorUtils.usesOfficeUserAgent(editor)) {
4949
webView.settings.userAgentString = generateOnlyOfficeUserAgent()
5050
}
5151

0 commit comments

Comments
 (0)