mirror of
https://github.com/nextcloud/android-library.git
synced 2025-07-29 12:02:15 +00:00
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Nextcloud Android Library
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Your Name <your@email.com>
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
package com.owncloud.android.lib.resources.declarativeui
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class Endpoint(val name: String, val relativeURL: String) : Parcelable
|
@ -176,6 +176,10 @@ public class GetCapabilitiesRemoteOperation extends RemoteOperation {
|
||||
// notes folder location
|
||||
private static final String NODE_NOTES = "notes";
|
||||
private static final String NOTES_PATH = "notes_path";
|
||||
|
||||
// declarative ui
|
||||
private static final String NODE_DECLARATIVE_UI = "declarativeui";
|
||||
private static final String NODE_CONTEXT_MENU = "context-menu";
|
||||
|
||||
private static final String PROPERTY_DEFAULT_PERMISSIONS = "default_permissions";
|
||||
|
||||
@ -795,6 +799,23 @@ public class GetCapabilitiesRemoteOperation extends RemoteOperation {
|
||||
capability.setNotesFolderPath(notesFolderPath);
|
||||
}
|
||||
}
|
||||
|
||||
// declarative ui
|
||||
if (respCapabilities.has(NODE_DECLARATIVE_UI)) {
|
||||
JSONObject declarativeUiCapability = respCapabilities.getJSONObject(NODE_DECLARATIVE_UI);
|
||||
|
||||
if (declarativeUiCapability.has(NODE_CONTEXT_MENU)) {
|
||||
String array = declarativeUiCapability.getString(NODE_CONTEXT_MENU);
|
||||
|
||||
// ArrayList<Endpoint> endpoints = new ArrayList<>();
|
||||
//
|
||||
// for (int i = 0; i < array.length(); i++) {
|
||||
// endpoints.add(new Endpoint(array.getJSONArray(i).getString(0),
|
||||
// array.getJSONArray(i).getString(1)));
|
||||
// }
|
||||
capability.setDeclarativeUiContextMenuJson(array);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
*/
|
||||
package com.owncloud.android.lib.resources.status
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.owncloud.android.lib.resources.declarativeui.Endpoint
|
||||
|
||||
/**
|
||||
* Contains data of the Capabilities for an account, from the Capabilities API
|
||||
*/
|
||||
@ -119,6 +123,24 @@ class OCCapability {
|
||||
|
||||
// notes folder location
|
||||
var notesFolderPath: String? = null
|
||||
|
||||
// declarative ui
|
||||
var declarativeUiContextMenuJson: String? = null
|
||||
val declarativeUiContextMenu: List<Endpoint>
|
||||
|
||||
get() {
|
||||
val listType = object : TypeToken<Array<Array<String>>>() {}.type
|
||||
val arrayList : Array<Array<String>> = Gson().fromJson(declarativeUiContextMenuJson, listType)
|
||||
|
||||
var returnList = mutableListOf<Endpoint>();
|
||||
|
||||
for (a in arrayList) {
|
||||
returnList.add(Endpoint(a[0], a[1]))
|
||||
}
|
||||
|
||||
return returnList
|
||||
}
|
||||
|
||||
|
||||
// Etag for capabilities
|
||||
var etag: String? = ""
|
||||
|
Reference in New Issue
Block a user