diff --git a/CHANGELOG.md b/CHANGELOG.md index 68fc23a584f9..11101089d67a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Summary * Enhancement - Copy/move conflict solved by users: [#3935](https://github.com/owncloud/android/issues/3935) * Enhancement - Improve grid mode: [#4027](https://github.com/owncloud/android/issues/4027) * Enhancement - File name conflict starting by (1): [#4040](https://github.com/owncloud/android/pull/4040) +* Enhancement - Respect app_providers_appsUrl value from capabilities: [#4075](https://github.com/owncloud/android/issues/4075) * Enhancement - Support "per app" language change on Android 13+: [#4082](https://github.com/owncloud/android/issues/4082) Details @@ -119,6 +120,14 @@ Details https://github.com/owncloud/android/issues/3946 https://github.com/owncloud/android/pull/4040 +* Enhancement - Respect app_providers_appsUrl value from capabilities: [#4075](https://github.com/owncloud/android/issues/4075) + + Now, the app receives the app_providers_appsUrl from the local database. Before of this + issue, the value was hardcoded. + + https://github.com/owncloud/android/issues/4075 + https://github.com/owncloud/android/pull/4113 + * Enhancement - Support "per app" language change on Android 13+: [#4082](https://github.com/owncloud/android/issues/4082) The locales_config.xml file has been created for the application to detect the language that diff --git a/changelog/unreleased/4113 b/changelog/unreleased/4113 new file mode 100644 index 000000000000..e91b92287f00 --- /dev/null +++ b/changelog/unreleased/4113 @@ -0,0 +1,6 @@ +Enhancement: Respect app_providers_appsUrl value from capabilities + +Now, the app receives the app_providers_appsUrl from the local database. Before of this issue, the value was hardcoded. + +https://github.com/owncloud/android/issues/4075 +https://github.com/owncloud/android/pull/4113 diff --git a/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/RepositoryModule.kt b/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/RepositoryModule.kt index f06323e48590..ee741111e891 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/RepositoryModule.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/RepositoryModule.kt @@ -51,7 +51,7 @@ import com.owncloud.android.domain.webfinger.WebFingerRepository import org.koin.dsl.module val repositoryModule = module { - factory { OCAppRegistryRepository(get(), get()) } + factory { OCAppRegistryRepository(get(), get(), get()) } factory { OCAuthenticationRepository(get(), get()) } factory { OCCapabilityRepository(get(), get(), get()) } factory { OCFileRepository(get(), get(), get(), get()) } diff --git a/owncloudData/src/main/java/com/owncloud/android/data/appregistry/OCAppRegistryRepository.kt b/owncloudData/src/main/java/com/owncloud/android/data/appregistry/OCAppRegistryRepository.kt index 733e5367b1bd..51f872f7f3e5 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/appregistry/OCAppRegistryRepository.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/appregistry/OCAppRegistryRepository.kt @@ -23,6 +23,7 @@ package com.owncloud.android.data.appregistry import com.owncloud.android.data.appregistry.datasources.LocalAppRegistryDataSource import com.owncloud.android.data.appregistry.datasources.RemoteAppRegistryDataSource +import com.owncloud.android.data.capabilities.datasources.LocalCapabilitiesDataSource import com.owncloud.android.domain.appregistry.AppRegistryRepository import com.owncloud.android.domain.appregistry.model.AppRegistryMimeType import kotlinx.coroutines.flow.Flow @@ -30,9 +31,12 @@ import kotlinx.coroutines.flow.Flow class OCAppRegistryRepository( private val localAppRegistryDataSource: LocalAppRegistryDataSource, private val remoteAppRegistryDataSource: RemoteAppRegistryDataSource, + private val localCapabilitiesDataSource: LocalCapabilitiesDataSource ) : AppRegistryRepository { override fun refreshAppRegistryForAccount(accountName: String) { - remoteAppRegistryDataSource.getAppRegistryForAccount(accountName).also { + val capabilities = localCapabilitiesDataSource.getCapabilityForAccount(accountName)//remoteAppRegistryDataSource.getCapabilities(accountName) + val appUrl = capabilities?.filesAppProviders?.appsUrl?.substring(1) + remoteAppRegistryDataSource.getAppRegistryForAccount(accountName, appUrl).also { localAppRegistryDataSource.saveAppRegistryForAccount(it) } } diff --git a/owncloudData/src/main/java/com/owncloud/android/data/appregistry/datasources/RemoteAppRegistryDataSource.kt b/owncloudData/src/main/java/com/owncloud/android/data/appregistry/datasources/RemoteAppRegistryDataSource.kt index 3ab7ae2879a9..0078e1398f3b 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/appregistry/datasources/RemoteAppRegistryDataSource.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/appregistry/datasources/RemoteAppRegistryDataSource.kt @@ -25,7 +25,8 @@ import com.owncloud.android.domain.appregistry.model.AppRegistry interface RemoteAppRegistryDataSource { fun getAppRegistryForAccount( - accountName: String + accountName: String, + appUrl: String? ): AppRegistry fun getUrlToOpenInWeb( diff --git a/owncloudData/src/main/java/com/owncloud/android/data/appregistry/datasources/implementation/OCRemoteAppRegistryDataSource.kt b/owncloudData/src/main/java/com/owncloud/android/data/appregistry/datasources/implementation/OCRemoteAppRegistryDataSource.kt index 171fffe8ef69..6a920a29058b 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/appregistry/datasources/implementation/OCRemoteAppRegistryDataSource.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/appregistry/datasources/implementation/OCRemoteAppRegistryDataSource.kt @@ -32,9 +32,9 @@ import com.owncloud.android.lib.resources.appregistry.responses.AppRegistryRespo class OCRemoteAppRegistryDataSource( private val clientManager: ClientManager ) : RemoteAppRegistryDataSource { - override fun getAppRegistryForAccount(accountName: String): AppRegistry = + override fun getAppRegistryForAccount(accountName: String, appUrl: String?): AppRegistry = executeRemoteOperation { - clientManager.getAppRegistryService(accountName).getAppRegistry() + clientManager.getAppRegistryService(accountName).getAppRegistry(appUrl) }.toModel(accountName) override fun getUrlToOpenInWeb(