Skip to content

Commit

Permalink
Merge pull request #4154 from owncloud/release/4.1_bis
Browse files Browse the repository at this point in the history
Release/4.1 (extra)
  • Loading branch information
Aitorbp authored Sep 6, 2023
2 parents b6982af + b40c5d0 commit df2d0e6
Show file tree
Hide file tree
Showing 43 changed files with 129 additions and 39 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Changelog for ownCloud Android Client [unreleased] (UNRELEASED)
Changelog for ownCloud Android Client [4.1.0] (2023-08-23)
=======================================
The following sections list the changes in ownCloud Android Client unreleased relevant to
The following sections list the changes in ownCloud Android Client 4.1.0 relevant to
ownCloud admins and users.

[unreleased]: https://github.com/owncloud/android/compare/v4.0.0...master
[4.1.0]: https://github.com/owncloud/android/compare/v4.0.0...v4.1.0

Summary
-------
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added docs_resources/detail_view_device.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs_resources/filelist_device.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs_resources/photos_device.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions owncloudApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ android {

testInstrumentationRunner "com.owncloud.android.utils.OCTestAndroidJUnitRunner"

versionCode = 40000001
versionName = "4.1.0-beta.1"
versionCode = 41000000
versionName = "4.1.0"

buildConfigField "String", gitRemote, "\"" + getGitOriginRemote() + "\""
buildConfigField "String", commitSHA1, "\"" + getLatestGitHash() + "\""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ import android.content.Intent
import androidx.test.core.app.ActivityScenario
import androidx.test.core.app.ApplicationProvider
import com.owncloud.android.R
import com.owncloud.android.presentation.releasenotes.ReleaseNote
import com.owncloud.android.presentation.releasenotes.ReleaseNoteType
import com.owncloud.android.presentation.releasenotes.ReleaseNotesActivity
import com.owncloud.android.presentation.releasenotes.ReleaseNotesViewModel
import com.owncloud.android.utils.click
import com.owncloud.android.utils.matchers.assertChildCount
import com.owncloud.android.utils.matchers.isDisplayed
import com.owncloud.android.utils.matchers.withText
import com.owncloud.android.utils.releaseNotesList
import io.mockk.every
import io.mockk.mockk
import org.junit.Assert.assertEquals
Expand All @@ -48,6 +49,23 @@ class ReleaseNotesActivityTest {

private lateinit var releaseNotesViewModel: ReleaseNotesViewModel

private val releaseNotesList = listOf(
ReleaseNote(
title = R.string.release_notes_4_1_title_1,
subtitle = R.string.release_notes_4_1_subtitle_1,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_1_title_2,
subtitle = R.string.release_notes_4_1_subtitle_2,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_1_title_3,
subtitle = R.string.release_notes_4_1_subtitle_3,
type = ReleaseNoteType.ENHANCEMENT,
),
)
@Before
fun setUp() {
context = ApplicationProvider.getApplicationContext()
Expand Down Expand Up @@ -109,6 +127,6 @@ class ReleaseNotesActivityTest {

@Test
fun test_childCount() {
R.id.releaseNotes.assertChildCount(3)
R.id.releaseNotes.assertChildCount(releaseNotesList.size)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,38 @@ import com.owncloud.android.presentation.releasenotes.ReleaseNoteType

val releaseNotesList = listOf(
ReleaseNote(
title = R.string.release_notes_header,
subtitle = R.string.release_notes_footer,
type = ReleaseNoteType.BUGFIX
title = R.string.release_notes_4_1_title_1,
subtitle = R.string.release_notes_4_1_subtitle_1,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_header,
subtitle = R.string.release_notes_footer,
type = ReleaseNoteType.BUGFIX
title = R.string.release_notes_4_1_title_2,
subtitle = R.string.release_notes_4_1_subtitle_2,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_header,
subtitle = R.string.release_notes_footer,
type = ReleaseNoteType.ENHANCEMENT
)
title = R.string.release_notes_4_1_title_3,
subtitle = R.string.release_notes_4_1_subtitle_3,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_1_title_4,
subtitle = R.string.release_notes_4_1_subtitle_4,
type = ReleaseNoteType.BUGFIX,
),
ReleaseNote(
title = R.string.release_notes_4_1_title_5,
subtitle = R.string.release_notes_4_1_subtitle_5,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_1_title_6,
subtitle = R.string.release_notes_4_1_subtitle_6,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_1_title_7,
subtitle = R.string.release_notes_4_1_subtitle_7,
type = ReleaseNoteType.BUGFIX,
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import com.owncloud.android.domain.authentication.oauth.model.ResponseType
import com.owncloud.android.domain.authentication.oauth.model.TokenRequest
import com.owncloud.android.domain.exceptions.NoNetworkConnectionException
import com.owncloud.android.domain.exceptions.OwncloudVersionNotSupportedException
import com.owncloud.android.domain.exceptions.SSLErrorCode
import com.owncloud.android.domain.exceptions.SSLErrorException
import com.owncloud.android.domain.exceptions.ServerNotReachableException
import com.owncloud.android.domain.exceptions.StateMismatchException
Expand Down Expand Up @@ -379,21 +380,21 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted

private fun getServerInfoIsError(uiResult: UIResult.Error<ServerInfo>) {
updateCenteredRefreshButtonVisibility(shouldBeVisible = true)
when (uiResult.error) {
is CertificateCombinedException ->
when {
uiResult.error is CertificateCombinedException ->
showUntrustedCertDialog(uiResult.error)

is OwncloudVersionNotSupportedException -> binding.serverStatusText.run {
uiResult.error is OwncloudVersionNotSupportedException -> binding.serverStatusText.run {
text = getString(R.string.server_not_supported)
setCompoundDrawablesWithIntrinsicBounds(R.drawable.common_error, 0, 0, 0)
}

is NoNetworkConnectionException -> binding.serverStatusText.run {
uiResult.error is NoNetworkConnectionException -> binding.serverStatusText.run {
text = getString(R.string.error_no_network_connection)
setCompoundDrawablesWithIntrinsicBounds(R.drawable.no_network, 0, 0, 0)
}

is SSLErrorException -> binding.serverStatusText.run {
uiResult.error is SSLErrorException && uiResult.error.code == SSLErrorCode.NOT_HTTP_ALLOWED -> binding.serverStatusText.run {
text = getString(R.string.ssl_connection_not_secure)
setCompoundDrawablesWithIntrinsicBounds(R.drawable.common_error, 0, 0, 0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import androidx.core.view.setMargins
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import coil.load
import com.owncloud.android.R
import com.owncloud.android.databinding.GridItemBinding
import com.owncloud.android.databinding.ItemFileListBinding
Expand Down Expand Up @@ -281,8 +280,7 @@ class FileListAdapter(

if (file.isFolder) {
// Folder
fileIcon.load(R.drawable.ic_menu_archive)

fileIcon.setImageResource(R.drawable.ic_menu_archive)
} else {
// Set file icon depending on its mimetype. Ask for thumbnail later.
fileIcon.setImageResource(MimetypeIconUtil.getFileTypeIconId(file.mimeType, file.fileName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,16 @@ class FileDisplayActivity : FileActivity(),

is UIResult.Error -> {
dismissLoadingDialog()
showMessageInSnackbar(message = getString(R.string.copy_file_error))

uiResult.error?.let {
showMessageInSnackbar(
message = it.parseError(
genericErrorMessage = getString(R.string.copy_file_error),
resources = resources,
showJustReason = true,
)
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ class RemoteFileUtils {
fun getAvailableRemotePath(
ownCloudClient: OwnCloudClient,
remotePath: String,
spaceWebDavUrl: String? = null
spaceWebDavUrl: String? = null,
isUserLogged: Boolean,
): String {
var checkExistsFile = existsFile(ownCloudClient, remotePath, spaceWebDavUrl)
var checkExistsFile = existsFile(
ownCloudClient = ownCloudClient,
remotePath = remotePath,
spaceWebDavUrl = spaceWebDavUrl,
isUserLogged = isUserLogged,
)
if (!checkExistsFile) {
return remotePath
}
Expand All @@ -56,9 +62,19 @@ class RemoteFileUtils {
do {
suffix = " ($count)"
checkExistsFile = if (pos >= 0) {
existsFile(ownCloudClient, "${remotePath.substringBeforeLast('.', "")}$suffix.$extension", spaceWebDavUrl)
existsFile(
ownCloudClient = ownCloudClient,
remotePath = "${remotePath.substringBeforeLast('.', "")}$suffix.$extension",
spaceWebDavUrl = spaceWebDavUrl,
isUserLogged = isUserLogged,
)
} else {
existsFile(ownCloudClient, remotePath + suffix, spaceWebDavUrl)
existsFile(
ownCloudClient = ownCloudClient,
remotePath = remotePath + suffix,
spaceWebDavUrl = spaceWebDavUrl,
isUserLogged = isUserLogged,
)
}
count++
} while (checkExistsFile)
Expand All @@ -73,11 +89,12 @@ class RemoteFileUtils {
ownCloudClient: OwnCloudClient,
remotePath: String,
spaceWebDavUrl: String?,
isUserLogged: Boolean,
): Boolean {
val existsOperation =
CheckPathExistenceRemoteOperation(
remotePath = remotePath,
isUserLoggedIn = false,
isUserLoggedIn = isUserLogged,
spaceWebDavUrl = spaceWebDavUrl,
)
return existsOperation.execute(ownCloudClient).isSuccess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,12 @@ class UploadFileFromContentUriWorker(
var pathToGrant: String = File(uploadPath).parent ?: ""
pathToGrant = if (pathToGrant.endsWith(File.separator)) pathToGrant else pathToGrant + File.separator

val checkPathExistenceOperation = CheckPathExistenceRemoteOperation(pathToGrant, false, spaceWebDavUrl)
val checkPathExistenceOperation =
CheckPathExistenceRemoteOperation(
remotePath = pathToGrant,
isUserLoggedIn = AccountUtils.getCurrentOwnCloudAccount(appContext) != null,
spaceWebDavUrl = spaceWebDavUrl,
)
val checkPathExistenceResult = checkPathExistenceOperation.execute(client)
if (checkPathExistenceResult.code == ResultCode.FILE_NOT_FOUND) {
val createRemoteFolderOperation = CreateRemoteFolderOperation(
Expand All @@ -232,7 +237,12 @@ class UploadFileFromContentUriWorker(

private fun checkNameCollisionAndGetAnAvailableOneInCase(client: OwnCloudClient) {
Timber.d("Checking name collision in server")
val remotePath = getAvailableRemotePath(client, uploadPath, spaceWebDavUrl)
val remotePath = getAvailableRemotePath(
ownCloudClient = client,
remotePath = uploadPath,
spaceWebDavUrl = spaceWebDavUrl,
isUserLogged = AccountUtils.getCurrentOwnCloudAccount(appContext) != null,
)
if (remotePath != uploadPath) {
uploadPath = remotePath
Timber.d("Name collision detected, let's rename it to %s", remotePath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,26 @@ class UploadFileFromFileSystemWorker(
if (ocTransfer.forceOverwrite) {

val getFileByRemotePathUseCase: GetFileByRemotePathUseCase by inject()
val useCaseResult = getFileByRemotePathUseCase.execute(GetFileByRemotePathUseCase.Params(ocTransfer.accountName, ocTransfer.remotePath, ocTransfer.spaceId))
val useCaseResult = getFileByRemotePathUseCase.execute(
GetFileByRemotePathUseCase.Params(
ocTransfer.accountName,
ocTransfer.remotePath,
ocTransfer.spaceId
)
)

eTagInConflict = useCaseResult.getDataOrNull()?.etagInConflict.orEmpty()

Timber.d("Upload will overwrite current server file with the following etag in conflict: $eTagInConflict")
} else {

Timber.d("Checking name collision in server")
val remotePath = getAvailableRemotePath(client, uploadPath, spaceWebDavUrl)
val remotePath = getAvailableRemotePath(
ownCloudClient = client,
remotePath = uploadPath,
spaceWebDavUrl = spaceWebDavUrl,
isUserLogged = AccountUtils.getCurrentOwnCloudAccount(appContext) != null,
)
if (remotePath != uploadPath) {
uploadPath = remotePath
Timber.d("Name collision detected, let's rename it to $remotePath")
Expand Down
2 changes: 1 addition & 1 deletion owncloudApp/src/main/res/layout/log_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:src="@drawable/ic_share_generic"
android:src="@drawable/ic_share_grey"
app:layout_constraintRight_toLeftOf="@id/imageView_delete_activity_logs_list"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ package com.owncloud.android.domain.exceptions

import java.lang.Exception

class SSLErrorException(override val message: String? = null) : Exception(message)
class SSLErrorException(override val message: String? = null, val code: SSLErrorCode = SSLErrorCode.GENERIC) : Exception(message)

enum class SSLErrorCode { GENERIC, NOT_HTTP_ALLOWED }

const val NOT_HTTP_ALLOWED_MESSAGE = "Connection is not secure, http traffic is not allowed."
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
package com.owncloud.android.domain.server.usecases

import com.owncloud.android.domain.BaseUseCaseWithResult
import com.owncloud.android.domain.exceptions.NOT_HTTP_ALLOWED_MESSAGE
import com.owncloud.android.domain.exceptions.SSLErrorCode
import com.owncloud.android.domain.exceptions.SSLErrorException
import com.owncloud.android.domain.server.ServerInfoRepository
import com.owncloud.android.domain.server.model.ServerInfo
Expand All @@ -34,7 +36,7 @@ class GetServerInfoAsyncUseCase(
val normalizedServerUrl = normalizeProtocolPrefix(params.serverPath).trimEnd(TRAILING_SLASH)
val serverInfo = serverInfoRepository.getServerInfo(normalizedServerUrl, params.creatingAccount)
if (!serverInfo.isSecureConnection && params.secureConnectionEnforced) {
throw SSLErrorException("Connection is not secure, http traffic is not allowed.")
throw SSLErrorException(NOT_HTTP_ALLOWED_MESSAGE, SSLErrorCode.NOT_HTTP_ALLOWED)
}
return serverInfo
}
Expand Down

0 comments on commit df2d0e6

Please sign in to comment.