Skip to content

Commit 160362e

Browse files
committed
fix: adapt documents provider for multi-personal accounts
1 parent 2a3f5fc commit 160362e

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

owncloudApp/src/main/java/com/owncloud/android/presentation/documentsprovider/DocumentsStorageProvider.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
* @author Abel García de Prada
88
* @author Shashvat Kedia
99
* @author Juan Carlos Garrote Gascón
10+
* @author Jorge Aguado Recio
1011
*
1112
* Copyright (C) 2015 Bartosz Przybylski
12-
* Copyright (C) 2023 ownCloud GmbH.
13+
* Copyright (C) 2025 ownCloud GmbH.
1314
*
1415
* This program is free software: you can redistribute it and/or modify
1516
* it under the terms of the GNU General Public License version 2,
@@ -198,6 +199,14 @@ class DocumentsStorageProvider : DocumentsProvider() {
198199
val getPersonalAndProjectSpacesForAccountUseCase: GetPersonalAndProjectSpacesForAccountUseCase by inject()
199200
val getSpaceByIdForAccountUseCase: GetSpaceByIdForAccountUseCase by inject()
200201
val getFileByRemotePathUseCase: GetFileByRemotePathUseCase by inject()
202+
val getStoredCapabilitiesUseCase: GetStoredCapabilitiesUseCase by inject()
203+
val capabilities = getStoredCapabilitiesUseCase(
204+
GetStoredCapabilitiesUseCase.Params(
205+
accountName = parentDocumentId
206+
)
207+
)
208+
val isMultiPersonal = capabilities?.spaces?.hasMultiplePersonalSpaces == true
209+
201210

202211
getPersonalAndProjectSpacesForAccountUseCase(
203212
GetPersonalAndProjectSpacesForAccountUseCase.Params(
@@ -212,7 +221,7 @@ class DocumentsStorageProvider : DocumentsProvider() {
212221
spaceId = space.id,
213222
)
214223
).getDataOrNull()?.let { rootFolder ->
215-
resultCursor.addSpace(space, rootFolder, context)
224+
resultCursor.addSpace(space, rootFolder, context, isMultiPersonal)
216225
}
217226
}
218227
}

owncloudApp/src/main/java/com/owncloud/android/presentation/documentsprovider/cursors/SpaceCursor.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
* ownCloud Android client application
33
*
44
* @author Juan Carlos Garrote Gascón
5+
* @author Jorge Aguado Recio
56
*
6-
* Copyright (C) 2023 ownCloud GmbH.
7+
* Copyright (C) 2025 ownCloud GmbH.
78
*
89
* This program is free software: you can redistribute it and/or modify
910
* it under the terms of the GNU General Public License version 2,
@@ -39,14 +40,14 @@ class SpaceCursor(projection: Array<String>?) : MatrixCursor(projection ?: DEFAU
3940
cursorExtras = Bundle().apply { putBoolean(DocumentsContract.EXTRA_LOADING, hasMoreToSync) }
4041
}
4142

42-
fun addSpace(space: OCSpace, rootFolder: OCFile, context: Context?) {
43+
fun addSpace(space: OCSpace, rootFolder: OCFile, context: Context?, isMultiPersonal: Boolean = false) {
4344
val flags = if (rootFolder.hasAddFilePermission && rootFolder.hasAddSubdirectoriesPermission) {
4445
Document.FLAG_DIR_SUPPORTS_CREATE
4546
} else {
4647
0
4748
}
4849

49-
val name = if (space.isPersonal) context?.getString(R.string.bottom_nav_personal) else space.name
50+
val name = if (space.isPersonal && !isMultiPersonal) context?.getString(R.string.bottom_nav_personal) else space.name
5051

5152
newRow()
5253
.add(Document.COLUMN_DOCUMENT_ID, rootFolder.id)

owncloudData/src/main/java/com/owncloud/android/data/authentication/datasources/implementation/OCRemoteAuthenticationDataSource.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
* ownCloud Android client application
33
*
44
* @author Abel García de Prada
5-
* Copyright (C) 2020 ownCloud GmbH.
5+
* @author Jorge Aguado Recio
6+
*
7+
* Copyright (C) 2025 ownCloud GmbH.
68
*
79
* This program is free software: you can redistribute it and/or modify
810
* it under the terms of the GNU General Public License version 2,
@@ -60,6 +62,10 @@ class OCRemoteAuthenticationDataSource(
6062
GetRemoteUserInfoOperation().execute(client)
6163
}.let { userInfo = it.toDomain() }
6264

65+
if (client.isKiteworksServer) {
66+
userInfo = userInfo.copy(id = userInfo.displayName)
67+
}
68+
6369
return Pair(userInfo, userBaseUri)
6470
}
6571
}

0 commit comments

Comments
 (0)