Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 0fc3f76

Browse files
committed
Use the same ownCloudClient across the whole login process
1 parent 18b2716 commit 0fc3f76

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/ServerInfoService.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@
2323
*/
2424
package com.owncloud.android.lib.resources.status.services
2525

26+
import com.owncloud.android.lib.common.OwnCloudClient
2627
import com.owncloud.android.lib.common.operations.RemoteOperationResult
2728
import com.owncloud.android.lib.resources.status.OwnCloudVersion
2829

2930
interface ServerInfoService {
30-
fun checkPathExistence(path: String, isUserLogged: Boolean): RemoteOperationResult<Boolean>
31+
fun checkPathExistence(path: String, isUserLogged: Boolean, client: OwnCloudClient): RemoteOperationResult<Boolean>
3132

32-
fun getRemoteStatus(path: String): RemoteOperationResult<OwnCloudVersion>
33+
fun getRemoteStatus(path: String, client: OwnCloudClient): RemoteOperationResult<OwnCloudVersion>
3334
}

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/services/implementation/OCServerInfoService.kt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,28 @@
1919

2020
package com.owncloud.android.lib.resources.status.services.implementation
2121

22-
import android.net.Uri
2322
import com.owncloud.android.lib.common.OwnCloudClient
24-
import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory.getAnonymousCredentials
2523
import com.owncloud.android.lib.common.operations.RemoteOperationResult
26-
import com.owncloud.android.lib.resources.status.services.ServerInfoService
2724
import com.owncloud.android.lib.resources.files.CheckPathExistenceRemoteOperation
2825
import com.owncloud.android.lib.resources.status.GetRemoteStatusOperation
2926
import com.owncloud.android.lib.resources.status.OwnCloudVersion
27+
import com.owncloud.android.lib.resources.status.services.ServerInfoService
3028

3129
class OCServerInfoService : ServerInfoService {
32-
override fun checkPathExistence(path: String, isUserLogged: Boolean): RemoteOperationResult<Boolean> =
30+
31+
override fun checkPathExistence(
32+
path: String,
33+
isUserLogged: Boolean,
34+
client: OwnCloudClient
35+
): RemoteOperationResult<Boolean> =
3336
CheckPathExistenceRemoteOperation(
3437
remotePath = path,
3538
isUserLogged = true
36-
).execute(createClientFromPath(path))
37-
38-
override fun getRemoteStatus(path: String): RemoteOperationResult<OwnCloudVersion> =
39-
GetRemoteStatusOperation().execute(createClientFromPath(path))
39+
).execute(client)
4040

41-
private fun createClientFromPath(path: String): OwnCloudClient {
42-
return OwnCloudClient(Uri.parse(path)).apply { credentials = getAnonymousCredentials() }
43-
}
41+
override fun getRemoteStatus(
42+
path: String,
43+
client: OwnCloudClient
44+
): RemoteOperationResult<OwnCloudVersion> =
45+
GetRemoteStatusOperation().execute(client)
4446
}

0 commit comments

Comments
 (0)