Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/src/main/java/com/nextcloud/utils/EditorUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class EditorUtils @Inject constructor(private val arbitraryDataProvider: Arbitra
return editors.any { usesOfficeUserAgent(it) && (mimeType in it.mimetypes || mimeType in it.optionalMimetypes) }
}

fun isRichDocumentsDirectEditingAvailable(user: User?): Boolean =
getEditors(user)?.any { it.id == RICH_DOCUMENTS_EDITOR_ID } == true

private fun getEditors(user: User?): Collection<Editor>? {
val json = arbitraryDataProvider.getValue(user, ArbitraryDataProvider.DIRECT_EDITING)
if (json.isEmpty()) return null
Expand All @@ -57,6 +60,7 @@ class EditorUtils @Inject constructor(private val arbitraryDataProvider: Arbitra
fun usesOfficeUserAgent(editor: Editor?): Boolean = editor?.id in OFFICE_EDITOR_IDS

companion object {
private const val RICH_DOCUMENTS_EDITOR_ID = "richdocuments"
private val OFFICE_EDITOR_IDS = setOf("onlyoffice", "eurooffice")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class ChooseTemplateDialogFragment :
path,
creator?.editor,
creator?.id,
template.title
template.id

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

).execute(nextcloudClient)
if (!result.isSuccess) {
return ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ class OCFileListBottomSheetDialog(
}

private fun creatorsActionsFromCollabora(): List<CreatorAction> {
// richdocuments 11+ serves its creators through DirectEditing, so the legacy entries would be duplicates.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (editorUtils.isRichDocumentsDirectEditingAvailable(user)) {
return emptyList()
}

val creatorsActions = ArrayList<CreatorAction>()

fileActivity.capabilities
Expand Down
Loading