Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Respect app_provider values from capabilities #4113

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Summary
* Enhancement - Improve UX of creation dialog: [#4031](https://github.com/owncloud/android/issues/4031)
* Enhancement - File name conflict starting by (1): [#4040](https://github.com/owncloud/android/pull/4040)
* Enhancement - Prevent http traffic with branding options: [#4066](https://github.com/owncloud/android/issues/4066)
* 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)
* Enhancement - Align Sharing icons with other platforms: [#4101](https://github.com/owncloud/android/issues/4101)

Expand Down Expand Up @@ -147,6 +148,14 @@ Details
https://github.com/owncloud/android/issues/4066
https://github.com/owncloud/android/pull/4110

* 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
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/4113
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import com.owncloud.android.domain.webfinger.WebFingerRepository
import org.koin.dsl.module

val repositoryModule = module {
factory<AppRegistryRepository> { OCAppRegistryRepository(get(), get()) }
factory<AppRegistryRepository> { OCAppRegistryRepository(get(), get(), get()) }
factory<AuthenticationRepository> { OCAuthenticationRepository(get(), get()) }
factory<CapabilityRepository> { OCCapabilityRepository(get(), get(), get()) }
factory<FileRepository> { OCFileRepository(get(), get(), get(), get()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ 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

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)
val appUrl = capabilities?.filesAppProviders?.appsUrl?.substring(1)
remoteAppRegistryDataSource.getAppRegistryForAccount(accountName, appUrl).also {
localAppRegistryDataSource.saveAppRegistryForAccount(it)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down