Skip to content

Commit 7db0dad

Browse files
committed
Extend OCCapability to include notes folder location
Signed-off-by: ZetaTom <[email protected]>
1 parent 6c9ee03 commit 7db0dad

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

library/src/main/java/com/owncloud/android/lib/resources/status/GetCapabilitiesRemoteOperation.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ public class GetCapabilitiesRemoteOperation extends RemoteOperation {
173173
private static final String NODE_FILES_DOWNLOAD_LIMIT = "downloadlimit";
174174
private static final String FILES_DOWNLOAD_LIMIT_DEFAULT = "default-limit";
175175

176+
// notes folder location
177+
private static final String NODE_NOTES = "notes";
178+
private static final String NOTES_PATH = "notes_path";
179+
176180
private OCCapability currentCapability = null;
177181

178182
public GetCapabilitiesRemoteOperation() {
@@ -770,6 +774,22 @@ private OCCapability parseResponse(String response) throws JSONException {
770774
} else {
771775
capability.setRecommendations(CapabilityBooleanType.FALSE);
772776
}
777+
778+
// notes folder
779+
if (respCapabilities.has(NODE_NOTES)) {
780+
JSONObject notesCapability = respCapabilities.getJSONObject(NODE_NOTES);
781+
782+
if (notesCapability.has(NOTES_PATH)) {
783+
String notesFolderPath = notesCapability.getString(NOTES_PATH);
784+
785+
if (!notesFolderPath.isEmpty() && !notesFolderPath.endsWith("/")) {
786+
notesFolderPath += "/";
787+
}
788+
789+
capability.setNotesFolderPath(notesFolderPath);
790+
}
791+
}
792+
773793
}
774794

775795
Log_OC.d(TAG, "*** Get Capabilities completed ");

library/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ class OCCapability {
117117
var filesDownloadLimit = CapabilityBooleanType.UNKNOWN
118118
var filesDownloadLimitDefault = -1
119119

120+
// notes folder location
121+
var notesFolderPath: String? = null
122+
120123
// Etag for capabilities
121124
var etag: String? = ""
122125

0 commit comments

Comments
 (0)