From 792ba8a225043994720299a8fd7d85e6cccd6e1b Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Tue, 18 Dec 2018 16:20:03 +0100 Subject: [PATCH] add check for template support Signed-off-by: tobiasKaminsky --- .../status/GetRemoteCapabilitiesOperation.java | 11 +++++++++++ .../android/lib/resources/status/OCCapability.java | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.java b/src/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.java index ad7820ea0..38b259031 100644 --- a/src/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.java +++ b/src/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.java @@ -134,6 +134,7 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation { private static final String NODE_RICHDOCUMENTS = "richdocuments"; private static final String NODE_MIMETYPES = "mimetypes"; private static final String NODE_RICHDOCUMENTS_DIRECT_EDITING = "direct_editing"; + private static final String NODE_RICHDOCUMENTS_TEMPLATES = "templates"; // activity private static final String NODE_ACTIVITY = "activity"; @@ -425,6 +426,16 @@ protected RemoteOperationResult run(OwnCloudClient client) { } else { capability.setRichDocumentsDirectEditing(CapabilityBooleanType.FALSE); } + + if (richDocumentsCapability.has(NODE_RICHDOCUMENTS_TEMPLATES)) { + if (richDocumentsCapability.getBoolean(NODE_RICHDOCUMENTS_TEMPLATES)) { + capability.setRichdocumentsTemplatesAvailable(CapabilityBooleanType.TRUE); + } else { + capability.setRichdocumentsTemplatesAvailable(CapabilityBooleanType.FALSE); + } + } else { + capability.setRichdocumentsTemplatesAvailable(CapabilityBooleanType.FALSE); + } } else { capability.setRichDocuments(CapabilityBooleanType.FALSE); } diff --git a/src/com/owncloud/android/lib/resources/status/OCCapability.java b/src/com/owncloud/android/lib/resources/status/OCCapability.java index ac6d26c74..1564e2c92 100644 --- a/src/com/owncloud/android/lib/resources/status/OCCapability.java +++ b/src/com/owncloud/android/lib/resources/status/OCCapability.java @@ -91,6 +91,7 @@ public class OCCapability { // Richdocuments private CapabilityBooleanType richdocuments; private CapabilityBooleanType richdocumentsDirectEditing; + private CapabilityBooleanType richdocumentsTemplatesAvailable; private List richdocumentsMimeTypeList; private CapabilityBooleanType activity; @@ -145,6 +146,7 @@ public OCCapability() { richdocuments = CapabilityBooleanType.UNKNOWN; richdocumentsMimeTypeList = new ArrayList<>(); richdocumentsDirectEditing = CapabilityBooleanType.FALSE; + richdocumentsTemplatesAvailable = CapabilityBooleanType.FALSE; } @@ -496,4 +498,12 @@ public void setRichDocumentsDirectEditing(CapabilityBooleanType directEditing) { public CapabilityBooleanType getRichDocumentsDirectEditing() { return richdocumentsDirectEditing; } + + public CapabilityBooleanType getRichdocumentsTemplatesAvailable() { + return richdocumentsTemplatesAvailable; + } + + public void setRichdocumentsTemplatesAvailable(CapabilityBooleanType richdocumentsTemplatesAvailable) { + this.richdocumentsTemplatesAvailable = richdocumentsTemplatesAvailable; + } }