From 9492a5970c97535efe3e420dd6cc431ac584d254 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 21 Dec 2018 08:59:59 +0100 Subject: [PATCH 1/2] fix wrong check for direct editing Signed-off-by: tobiasKaminsky --- .../status/GetRemoteCapabilitiesOperation.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.java b/src/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.java index 98df87e0b..ad7820ea0 100644 --- a/src/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.java +++ b/src/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.java @@ -403,10 +403,10 @@ protected RemoteOperationResult run(OwnCloudClient client) { } if (respCapabilities.has(NODE_RICHDOCUMENTS)) { + JSONObject richDocumentsCapability = respCapabilities.getJSONObject(NODE_RICHDOCUMENTS); capability.setRichDocuments(CapabilityBooleanType.TRUE); - JSONArray mimeTypesArray = respCapabilities.getJSONObject(NODE_RICHDOCUMENTS) - .getJSONArray(NODE_MIMETYPES); + JSONArray mimeTypesArray = richDocumentsCapability.getJSONArray(NODE_MIMETYPES); ArrayList mimeTypes = new ArrayList<>(); @@ -416,8 +416,12 @@ protected RemoteOperationResult run(OwnCloudClient client) { capability.setRichDocumentsMimeTypeList(mimeTypes); - if (respCapabilities.has(NODE_RICHDOCUMENTS_DIRECT_EDITING)) { - capability.setRichDocumentsDirectEditing(CapabilityBooleanType.TRUE); + if (richDocumentsCapability.has(NODE_RICHDOCUMENTS_DIRECT_EDITING)) { + if (richDocumentsCapability.getBoolean(NODE_RICHDOCUMENTS_DIRECT_EDITING)) { + capability.setRichDocumentsDirectEditing(CapabilityBooleanType.TRUE); + } else { + capability.setRichDocumentsDirectEditing(CapabilityBooleanType.FALSE); + } } else { capability.setRichDocumentsDirectEditing(CapabilityBooleanType.FALSE); } From 792ba8a225043994720299a8fd7d85e6cccd6e1b Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Tue, 18 Dec 2018 16:20:03 +0100 Subject: [PATCH 2/2] 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; + } }