Skip to content

Commit

Permalink
add check for template support
Browse files Browse the repository at this point in the history
Signed-off-by: tobiasKaminsky <[email protected]>
  • Loading branch information
tobiasKaminsky committed Dec 21, 2018
1 parent 9492a59 commit 792ba8a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
}
Expand Down
10 changes: 10 additions & 0 deletions src/com/owncloud/android/lib/resources/status/OCCapability.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class OCCapability {
// Richdocuments
private CapabilityBooleanType richdocuments;
private CapabilityBooleanType richdocumentsDirectEditing;
private CapabilityBooleanType richdocumentsTemplatesAvailable;
private List<String> richdocumentsMimeTypeList;

private CapabilityBooleanType activity;
Expand Down Expand Up @@ -145,6 +146,7 @@ public OCCapability() {
richdocuments = CapabilityBooleanType.UNKNOWN;
richdocumentsMimeTypeList = new ArrayList<>();
richdocumentsDirectEditing = CapabilityBooleanType.FALSE;
richdocumentsTemplatesAvailable = CapabilityBooleanType.FALSE;
}


Expand Down Expand Up @@ -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;
}
}

0 comments on commit 792ba8a

Please sign in to comment.