Skip to content

Commit c5956b9

Browse files
committed
feat: allow sharing files in spaces
Signed-off-by: Jorge Aguado Recio <jaguado@izertis.com>
1 parent 5637e8a commit c5956b9

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

‎owncloudApp/src/main/java/com/owncloud/android/usecases/files/FilterFileMenuOptionsUseCase.kt‎

Lines changed: 3 additions & 10 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) 2026 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,
@@ -27,14 +28,12 @@ import com.owncloud.android.domain.capabilities.CapabilityRepository
2728
import com.owncloud.android.domain.files.model.FileMenuOption
2829
import com.owncloud.android.domain.files.model.OCFile
2930
import com.owncloud.android.domain.files.model.OCFileSyncInfo
30-
import com.owncloud.android.domain.spaces.usecases.GetSpaceWithSpecialsByIdForAccountUseCase
3131
import com.owncloud.android.extensions.getRunningWorkInfosByTags
3232
import com.owncloud.android.usecases.transfers.TRANSFER_TAG_DOWNLOAD
3333

3434
class FilterFileMenuOptionsUseCase(
3535
private val workManager: WorkManager,
3636
private val capabilityRepository: CapabilityRepository,
37-
private val getSpaceWithSpecialsByIdForAccountUseCase: GetSpaceWithSpecialsByIdForAccountUseCase,
3837
) : BaseUseCase<MutableList<FileMenuOption>, FilterFileMenuOptionsUseCase.Params>() {
3938
override fun run(params: Params): MutableList<FileMenuOption> {
4039
val optionsToShow = mutableListOf<FileMenuOption>()
@@ -46,11 +45,6 @@ class FilterFileMenuOptionsUseCase(
4645

4746
val filesSyncInfo = params.filesSyncInfo
4847
val capability = capabilityRepository.getStoredCapabilities(params.accountName)
49-
val space = getSpaceWithSpecialsByIdForAccountUseCase(GetSpaceWithSpecialsByIdForAccountUseCase.Params(
50-
spaceId = files.first().spaceId,
51-
accountName = params.accountName,
52-
))
53-
5448
val isAnyFileSynchronizing: Boolean = if (filesSyncInfo.isEmpty()) {
5549
anyFileSynchronizingLookingIntoWorkers(files, params.accountName)
5650
} else {
@@ -70,7 +64,6 @@ class FilterFileMenuOptionsUseCase(
7064
} else {
7165
false
7266
}
73-
val isPersonalSpace = space?.isPersonal ?: true
7467
val resharingAllowed = capability?.let { !anyFileSharedWithMe(files) || it.filesSharingResharing.isTrue } ?: false
7568
val displaySelectAll = params.displaySelectAll
7669
val displaySelectInverse = params.displaySelectInverse
@@ -95,7 +88,7 @@ class FilterFileMenuOptionsUseCase(
9588
}
9689
// Share
9790
if (!onlyAvailableOfflineFiles && shareViaLinkOrWithUsersAllowed && resharingAllowed &&
98-
isPersonalSpace && hasResharePermission) {
91+
hasResharePermission) {
9992
optionsToShow.add(FileMenuOption.SHARE)
10093
}
10194
// Open with (different to preview!)

0 commit comments

Comments
 (0)