From 052566d2059c24ecb42b5c287060ea1d8636c5b6 Mon Sep 17 00:00:00 2001
From: Aitorbp <aitor.ballesteros.pavon@gmail.com>
Date: Mon, 31 Jul 2023 12:43:16 +0100
Subject: [PATCH] Added variable from local data source

---
 .../appregistry/GetRemoteAppRegistryOperation.kt          | 8 ++------
 .../resources/appregistry/services/AppRegistryService.kt  | 2 +-
 .../appregistry/services/OCAppRegistryService.kt          | 4 ++--
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/GetRemoteAppRegistryOperation.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/GetRemoteAppRegistryOperation.kt
index 60367ff0..e8ea864a 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/GetRemoteAppRegistryOperation.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/GetRemoteAppRegistryOperation.kt
@@ -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"
-    }
 }
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/services/AppRegistryService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/services/AppRegistryService.kt
index 50145892..789129bd 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/services/AppRegistryService.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/services/AppRegistryService.kt
@@ -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,
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/services/OCAppRegistryService.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/services/OCAppRegistryService.kt
index e07ac100..34693103 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/services/OCAppRegistryService.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/appregistry/services/OCAppRegistryService.kt
@@ -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(