Skip to content

Commit

Permalink
Merge pull request #1665 from nextcloud/feature/open-in-notes
Browse files Browse the repository at this point in the history
Extend OCCapability to include notes folder location
  • Loading branch information
tobiasKaminsky authored Feb 19, 2025
2 parents 6caf22a + d0d39ae commit 2c72914
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ public class GetCapabilitiesRemoteOperation extends RemoteOperation {
private static final String NODE_FILES_DOWNLOAD_LIMIT = "downloadlimit";
private static final String FILES_DOWNLOAD_LIMIT_DEFAULT = "default-limit";

// notes folder location
private static final String NODE_NOTES = "notes";
private static final String NOTES_PATH = "notes_path";

private OCCapability currentCapability = null;

public GetCapabilitiesRemoteOperation() {
Expand Down Expand Up @@ -770,6 +774,22 @@ private OCCapability parseResponse(String response) throws JSONException {
} else {
capability.setRecommendations(CapabilityBooleanType.FALSE);
}

// notes folder
if (respCapabilities.has(NODE_NOTES)) {
JSONObject notesCapability = respCapabilities.getJSONObject(NODE_NOTES);

if (notesCapability.has(NOTES_PATH)) {
String notesFolderPath = notesCapability.getString(NOTES_PATH);

if (!notesFolderPath.isEmpty() && !notesFolderPath.endsWith("/")) {
notesFolderPath += "/";
}

capability.setNotesFolderPath(notesFolderPath);
}
}

}

Log_OC.d(TAG, "*** Get Capabilities completed ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ class OCCapability {
var filesDownloadLimit = CapabilityBooleanType.UNKNOWN
var filesDownloadLimitDefault = -1

// notes folder location
var notesFolderPath: String? = null

// Etag for capabilities
var etag: String? = ""

Expand Down

0 comments on commit 2c72914

Please sign in to comment.