1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-06 15:36:45 +00:00

Added variable from local data source

This commit is contained in:
Aitorbp 2023-07-31 12:43:16 +01:00
parent 063c3fa9e9
commit 052566d205
3 changed files with 5 additions and 9 deletions

View File

@ -37,14 +37,14 @@ import com.squareup.moshi.Moshi
import timber.log.Timber
import java.net.URL
class GetRemoteAppRegistryOperation : RemoteOperation<AppRegistryResponse>() {
class GetRemoteAppRegistryOperation(private val appUrl: String?) : RemoteOperation<AppRegistryResponse>() {
override fun run(client: OwnCloudClient): RemoteOperationResult<AppRegistryResponse> {
var result: RemoteOperationResult<AppRegistryResponse>
try {
val uriBuilder = client.baseUri.buildUpon().apply {
appendEncodedPath(APP_REGISTRY_ENDPOINT)
appendEncodedPath(appUrl)
}
val getMethod = GetMethod(URL(uriBuilder.build().toString()))
val status = client.executeHttpMethod(getMethod)
@ -75,8 +75,4 @@ class GetRemoteAppRegistryOperation : RemoteOperation<AppRegistryResponse>() {
return result
}
companion object {
private const val APP_REGISTRY_ENDPOINT = "app/list"
}
}

View File

@ -28,7 +28,7 @@ import com.owncloud.android.lib.resources.Service
import com.owncloud.android.lib.resources.appregistry.responses.AppRegistryResponse
interface AppRegistryService : Service {
fun getAppRegistry(): RemoteOperationResult<AppRegistryResponse>
fun getAppRegistry(appUrl: String?): RemoteOperationResult<AppRegistryResponse>
fun getUrlToOpenInWeb(
openWebEndpoint: String,

View File

@ -31,8 +31,8 @@ import com.owncloud.android.lib.resources.appregistry.GetUrlToOpenInWebRemoteOpe
import com.owncloud.android.lib.resources.appregistry.responses.AppRegistryResponse
class OCAppRegistryService(override val client: OwnCloudClient) : AppRegistryService {
override fun getAppRegistry(): RemoteOperationResult<AppRegistryResponse> =
GetRemoteAppRegistryOperation().execute(client)
override fun getAppRegistry(appUrl: String?): RemoteOperationResult<AppRegistryResponse> =
GetRemoteAppRegistryOperation(appUrl).execute(client)
override fun getUrlToOpenInWeb(openWebEndpoint: String, fileId: String, appName: String): RemoteOperationResult<String> =
GetUrlToOpenInWebRemoteOperation(