Skip to content

Commit

Permalink
Merge pull request #4415 from owncloud/fix/lack_content_length_preven…
Browse files Browse the repository at this point in the history
…ts_downloads

[FIX] Downloads not working when `Content-Length` is not sent by the server
  • Loading branch information
JuancaG05 authored May 29, 2024
2 parents a41d1f9 + 2114b87 commit cd00d2e
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 356 deletions.
30 changes: 11 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Table of Contents

* [Changelog for unreleased](#changelog-for-owncloud-android-client-unreleased-unreleased)
* [Changelog for 4.2.2](#changelog-for-owncloud-android-client-422-2024-05-30)
* [Changelog for 4.2.1](#changelog-for-owncloud-android-client-421-2024-02-22)
* [Changelog for 4.2.0](#changelog-for-owncloud-android-client-420-2024-02-12)
* [Changelog for 4.1.1](#changelog-for-owncloud-android-client-411-2023-10-18)
Expand All @@ -20,35 +20,27 @@
* [Changelog for 2.18.1](#changelog-for-owncloud-android-client-2181-2021-07-20)
* [Changelog for 2.18.0](#changelog-for-owncloud-android-client-2180-2021-05-24)
* [Changelog for 2.17 versions and below](#changelog-for-217-versions-and-below)
# Changelog for ownCloud Android Client [unreleased] (UNRELEASED)
# Changelog for ownCloud Android Client [4.2.2] (2024-05-30)

The following sections list the changes in ownCloud Android Client unreleased relevant to
The following sections list the changes in ownCloud Android Client 4.2.2 relevant to
ownCloud admins and users.

[unreleased]: https://github.com/owncloud/android/compare/v4.2.1...master
[4.2.2]: https://github.com/owncloud/android/compare/v4.2.1...v4.2.2

## Summary

* Change - Upgrade minimum SDK version to Android 7.0 (v24): [#4230](https://github.com/owncloud/android/issues/4230)
* Enhancement - Unit tests for repository classes - Part 1: [#4232](https://github.com/owncloud/android/issues/4232)
* Bugfix - Downloads not working when `Content-Length` is not received: [#4352](https://github.com/owncloud/android/issues/4352)

## Details

* Change - Upgrade minimum SDK version to Android 7.0 (v24): [#4230](https://github.com/owncloud/android/issues/4230)
* Bugfix - Downloads not working when `Content-Length` is not received: [#4352](https://github.com/owncloud/android/issues/4352)

The minimum Android version will be Android 7.0 Nougat (API 24). The application
will no longer support previous versions.
The case when Content-Length header is not received in the response of a GET for
a download has been handled, and now the progress bar in images preview and
details view is indeterminate for those cases.

https://github.com/owncloud/android/issues/4230
https://github.com/owncloud/android/pull/4299

* Enhancement - Unit tests for repository classes - Part 1: [#4232](https://github.com/owncloud/android/issues/4232)

Unit tests for OCAppRegistryRepository, OCAuthenticationRepository and
OCCapabilityRepository classes have been completed.

https://github.com/owncloud/android/issues/4232
https://github.com/owncloud/android/pull/4281
https://github.com/owncloud/android/issues/4352
https://github.com/owncloud/android/pull/4415

# Changelog for ownCloud Android Client [4.2.1] (2024-02-22)

Expand Down
7 changes: 7 additions & 0 deletions changelog/4.2.2_2024-05-30/4415
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Downloads not working when `Content-Length` is not received

The case when Content-Length header is not received in the response of a GET for a download has been
handled, and now the progress bar in images preview and details view is indeterminate for those cases.

https://github.com/owncloud/android/issues/4352
https://github.com/owncloud/android/pull/4415
6 changes: 0 additions & 6 deletions changelog/unreleased/4281

This file was deleted.

6 changes: 0 additions & 6 deletions changelog/unreleased/4299

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Abel García de Prada
* @author Juan Carlos Garrote Gascón
*
* Copyright (C) 2023 ownCloud GmbH.
* Copyright (C) 2024 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 Down Expand Up @@ -448,9 +448,15 @@ class FileDetailsFragment : FileFragment() {
} else { // Transfer is upload (?)
getString(R.string.uploader_upload_in_progress_ticker)
}
val workProgress = workInfo.progress.getInt(DownloadFileWorker.WORKER_KEY_PROGRESS, -1)
binding.fdProgressBar.apply {
isIndeterminate = false
progress = workInfo.progress.getInt(DownloadFileWorker.WORKER_KEY_PROGRESS, -1)
if (workProgress == -1) {
isIndeterminate = true
} else {
isIndeterminate = false
progress = workProgress
invalidate()
}
}
binding.fdCancelBtn.setOnClickListener { fileDetailsViewModel.cancelCurrentTransfer() }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,58 +46,8 @@ class ReleaseNotesViewModel(
companion object {
val releaseNotesList = listOf(
ReleaseNote(
title = R.string.release_notes_4_2_0_title_1,
subtitle = R.string.release_notes_4_2_0_subtitle_1,
type = ReleaseNoteType.CHANGE,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_2,
subtitle = R.string.release_notes_4_2_0_subtitle_2,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_3,
subtitle = R.string.release_notes_4_2_0_subtitle_3,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_4,
subtitle = R.string.release_notes_4_2_0_subtitle_4,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_5,
subtitle = R.string.release_notes_4_2_0_subtitle_5,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_6,
subtitle = R.string.release_notes_4_2_0_subtitle_6,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_7,
subtitle = R.string.release_notes_4_2_0_subtitle_7,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_8,
subtitle = R.string.release_notes_4_2_0_subtitle_8,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_9,
subtitle = R.string.release_notes_4_2_0_subtitle_9,
type = ReleaseNoteType.CHANGE,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_10,
subtitle = R.string.release_notes_4_2_0_subtitle_10,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_2_0_title_11,
subtitle = R.string.release_notes_4_2_0_subtitle_11,
title = R.string.release_notes_4_2_2_title_downloads_content_length,
subtitle = R.string.release_notes_4_2_2_subtitle_downloads_content_length,
type = ReleaseNoteType.BUGFIX,
),
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*
* @author David A. Velasco
* @author Christian Schabesberger
* Copyright (C) 2020 ownCloud GmbH.
* @author Juan Carlos Garrote Gascón
*
* Copyright (C) 2024 ownCloud GmbH.
*
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -20,6 +22,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http:></http:>//www.gnu.org/licenses/>.
*/

package com.owncloud.android.ui.preview

import android.accounts.Account
Expand Down Expand Up @@ -220,11 +223,15 @@ class FileDownloadFragment : FileFragment() {
liveData?.observeWorkerTillItFinishes(
owner = this,
onWorkEnqueued = { progressBar?.isIndeterminate = true },
onWorkRunning = { progress ->
onWorkRunning = { workProgress ->
progressBar?.apply {
isIndeterminate = false
setProgress(progress)
invalidate()
if (workProgress == -1) {
isIndeterminate = true
} else {
isIndeterminate = false
progress = workProgress
invalidate()
}
}
},
onWorkSucceeded = { },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author Shashvat Kedia
* @author Juan Carlos Garrote Gascón
*
* Copyright (C) 2023 ownCloud GmbH.
* Copyright (C) 2024 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 Down Expand Up @@ -41,7 +41,6 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.ProgressBar
import com.owncloud.android.R
import com.owncloud.android.domain.files.model.OCFile
import com.owncloud.android.extensions.collectLatestLifecycleFlow
Expand All @@ -54,7 +53,6 @@ import com.owncloud.android.presentation.files.operations.FileOperation
import com.owncloud.android.presentation.files.operations.FileOperationsViewModel
import com.owncloud.android.presentation.files.removefile.RemoveFilesDialogFragment
import com.owncloud.android.presentation.previews.PreviewAudioViewModel
import com.owncloud.android.ui.controller.TransferProgressController
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment
import com.owncloud.android.ui.fragment.FileFragment
import com.owncloud.android.utils.PreferenceUtils
Expand Down Expand Up @@ -85,8 +83,6 @@ class PreviewAudioFragment : FileFragment() {
private var mediaController: MediaControlView? = null
private var mediaServiceConnection: MediaServiceConnection? = null
private var autoplay = true
private var progressBar: ProgressBar? = null
private var progressController: TransferProgressController? = null

private val previewAudioViewModel by viewModel<PreviewAudioViewModel>()
private val fileOperationsViewModel: FileOperationsViewModel by inject()
Expand Down Expand Up @@ -119,7 +115,6 @@ class PreviewAudioFragment : FileFragment() {

imagePreview = view.findViewById(R.id.image_preview)
mediaController = view.findViewById(R.id.media_controller)
progressBar = view.findViewById(R.id.syncProgressBar)
}

/**
Expand Down Expand Up @@ -148,9 +143,6 @@ class PreviewAudioFragment : FileFragment() {
check(file.isAvailableLocally) { "There is no local file to preview" }
check(file.isAudio) { "Not an audio file" }
extractAndSetCoverArt(file)
progressController = TransferProgressController(mContainerActivity).also {
it.setProgressBar(progressBar)
}
}

/**
Expand Down Expand Up @@ -216,11 +208,11 @@ class PreviewAudioFragment : FileFragment() {
}

override fun updateViewForSyncInProgress() {
progressController?.showProgressBar()
// Nothing to do here, sync is not shown in previews
}

override fun updateViewForSyncOff() {
progressController?.hideProgressBar()
// Nothing to do here, sync is not shown in previews
}

/**
Expand Down
Loading

0 comments on commit cd00d2e

Please sign in to comment.