Skip to content
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 @@ -42,6 +42,7 @@ ownCloud admins and users.
* Change - Replace dav4android location: [#4536](https://github.com/owncloud/android/issues/4536)
* Change - Modify biometrics fail source string: [#4572](https://github.com/owncloud/android/issues/4572)
* Enhancement - QA variant: [#3791](https://github.com/owncloud/android/issues/3791)
* Enhancement - Shares space in Android native file explorer: [#4515](https://github.com/owncloud/android/issues/4515)
* Enhancement - Accessibility reports in 4.5.1: [#4568](https://github.com/owncloud/android/issues/4568)

## Details
Expand Down Expand Up @@ -92,6 +93,14 @@ ownCloud admins and users.
https://github.com/owncloud/android/issues/3791
https://github.com/owncloud/android/pull/4569

* Enhancement - Shares space in Android native file explorer: [#4515](https://github.com/owncloud/android/issues/4515)

The Shares space has been added to the spaces list shown in the Documents
Provider, the Android native file explorer.

https://github.com/owncloud/android/issues/4515
https://github.com/owncloud/android/pull/4579

* Enhancement - Accessibility reports in 4.5.1: [#4568](https://github.com/owncloud/android/issues/4568)

Some content descriptions that were missing have been added to provide a better
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/4579
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Shares space in Android native file explorer

The Shares space has been added to the spaces list shown in the Documents Provider, the Android
native file explorer.

https://github.com/owncloud/android/issues/4515
https://github.com/owncloud/android/pull/4579
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ import com.owncloud.android.domain.files.usecases.GetFolderContentUseCase
import com.owncloud.android.domain.files.usecases.MoveFileUseCase
import com.owncloud.android.domain.files.usecases.RemoveFileUseCase
import com.owncloud.android.domain.files.usecases.RenameFileUseCase
import com.owncloud.android.domain.spaces.model.OCSpace.Companion.SPACE_ID_SHARES
import com.owncloud.android.domain.spaces.usecases.GetPersonalAndProjectSpacesForAccountUseCase
import com.owncloud.android.domain.spaces.usecases.GetSpaceByIdForAccountUseCase
import com.owncloud.android.domain.spaces.usecases.RefreshSpacesFromServerAsyncUseCase
import com.owncloud.android.presentation.authentication.AccountUtils
import com.owncloud.android.presentation.documentsprovider.cursors.FileCursor
Expand Down Expand Up @@ -194,6 +196,7 @@ class DocumentsStorageProvider : DocumentsProvider() {
resultCursor = SpaceCursor(projection)

val getPersonalAndProjectSpacesForAccountUseCase: GetPersonalAndProjectSpacesForAccountUseCase by inject()
val getSpaceByIdForAccountUseCase: GetSpaceByIdForAccountUseCase by inject()
val getFileByRemotePathUseCase: GetFileByRemotePathUseCase by inject()

getPersonalAndProjectSpacesForAccountUseCase(
Expand All @@ -214,6 +217,24 @@ class DocumentsStorageProvider : DocumentsProvider() {
}
}

getSpaceByIdForAccountUseCase(
GetSpaceByIdForAccountUseCase.Params(
accountName = parentDocumentId,
spaceId = SPACE_ID_SHARES,
)
)?.let { sharesSpace ->
getFileByRemotePathUseCase(
GetFileByRemotePathUseCase.Params(
owner = sharesSpace.accountName,
remotePath = ROOT_PATH,
spaceId = sharesSpace.id,
)
).getDataOrNull()?.let { rootFolder ->
resultCursor.addSpace(sharesSpace, rootFolder, context)
}
}


/**
* This will start syncing the spaces. User will only see this after updating his view with a
* pull down, or by accessing the spaces folder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* @author Bartosz Przybylski
* @author Abel García de Prada
* @author Juan Carlos Garrote Gascón
* @author Jorge Aguado Recio
*
* Copyright (C) 2015 Bartosz Przybylski
* Copyright (C) 2023 ownCloud GmbH.
* Copyright (C) 2025 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand All @@ -28,6 +29,7 @@ import android.os.Bundle
import android.provider.DocumentsContract
import android.provider.DocumentsContract.Document
import com.owncloud.android.domain.files.model.OCFile
import com.owncloud.android.domain.spaces.model.OCSpace.Companion.SPACE_ID_SHARES
import com.owncloud.android.utils.MimetypeIconUtil

class FileCursor(projection: Array<String>?) : MatrixCursor(projection ?: DEFAULT_DOCUMENT_PROJECTION) {
Expand All @@ -45,15 +47,17 @@ class FileCursor(projection: Array<String>?) : MatrixCursor(projection ?: DEFAUL
val imagePath = if (file.isImage && file.isAvailableLocally) file.storagePath else null
var flags = if (imagePath != null) Document.FLAG_SUPPORTS_THUMBNAIL else 0

flags = flags or Document.FLAG_SUPPORTS_DELETE
flags = flags or Document.FLAG_SUPPORTS_RENAME
flags = flags or Document.FLAG_SUPPORTS_COPY
flags = flags or Document.FLAG_SUPPORTS_MOVE
if (file.spaceId != SPACE_ID_SHARES) {
flags = flags or Document.FLAG_SUPPORTS_DELETE
flags = flags or Document.FLAG_SUPPORTS_RENAME
flags = flags or Document.FLAG_SUPPORTS_COPY
flags = flags or Document.FLAG_SUPPORTS_MOVE

if (mimeType != Document.MIME_TYPE_DIR) { // If it is a file
flags = flags or Document.FLAG_SUPPORTS_WRITE
} else if (file.hasAddFilePermission && file.hasAddSubdirectoriesPermission) { // If it is a folder with writing permissions
flags = flags or Document.FLAG_DIR_SUPPORTS_CREATE
if (mimeType != Document.MIME_TYPE_DIR) { // If it is a file
flags = flags or Document.FLAG_SUPPORTS_WRITE
} else if (file.hasAddFilePermission && file.hasAddSubdirectoriesPermission) { // If it is a folder with writing permissions
flags = flags or Document.FLAG_DIR_SUPPORTS_CREATE
}
}

newRow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class ReleaseNotesViewModel(

companion object {
val releaseNotesList = listOf(
ReleaseNote(
title = R.string.release_notes_4_6_0_title_shares_space_docs_provider,
subtitle = R.string.release_notes_4_6_0_subtitle_shares_space_docs_provider,
type = ReleaseNoteType.ENHANCEMENT
),
ReleaseNote(
title = R.string.release_notes_bugfixes_title,
subtitle = R.string.release_notes_bugfixes_subtitle,
Expand Down
2 changes: 2 additions & 0 deletions owncloudApp/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@
<string name="error_webfinger_username_empty">Username empty</string>

<!-- Release Notes -->
<string name="release_notes_4_6_0_title_shares_space_docs_provider">Shares space in Android native file explorer</string>
<string name="release_notes_4_6_0_subtitle_shares_space_docs_provider">Shares space now appears all together with the other spaces in Documents Provider in Infinite Scale accounts</string>
<string name="release_notes_header">New in %1$s</string>
<string name="release_notes_footer">Thank you for using %1$s.\n&#10084;</string>
<string name="release_notes_proceed">Proceed</string>
Expand Down
Loading