Skip to content

Reimplementing download progress and open when downloaded functionality#6096

Merged
mahibi merged 4 commits into
masterfrom
issue-6068-reimpl-download-progress
May 13, 2026
Merged

Reimplementing download progress and open when downloaded functionality#6096
mahibi merged 4 commits into
masterfrom
issue-6068-reimpl-download-progress

Conversation

@rapterjet2004
Copy link
Copy Markdown
Contributor

@rapterjet2004 rapterjet2004 commented Apr 20, 2026

🖼️ Screenshots

Screen_recording_20260420_115030.webm

🚧 TODO

  • linter

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@rapterjet2004 rapterjet2004 self-assigned this Apr 20, 2026
@rapterjet2004 rapterjet2004 added the 2. developing Work in progress label Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/24679084696/artifacts/6537211344
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@rapterjet2004 rapterjet2004 force-pushed the issue-6068-reimpl-download-progress branch from 7593e18 to 36a9b84 Compare April 21, 2026 14:14
@rapterjet2004 rapterjet2004 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Apr 21, 2026
@rapterjet2004 rapterjet2004 force-pushed the issue-6068-reimpl-download-progress branch from 36a9b84 to 62f707c Compare April 24, 2026 14:03
@github-actions
Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/24893617865/artifacts/6626258416
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@github-actions
Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/24896444887/artifacts/6627536459
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@rapterjet2004 rapterjet2004 requested a review from mahibi April 24, 2026 15:42
rapterjet2004 and others added 3 commits May 13, 2026 12:41
Reimplementing openWhenDownloaded functionality

Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi force-pushed the issue-6068-reimpl-download-progress branch from ba828be to 96f53c2 Compare May 13, 2026 11:03
 + mapNotNull replaces the unsafe as String cast

  the unnecessary toMutableList() is dropped

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@github-actions
Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/25795055404/artifacts/6968867293
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@mahibi
Copy link
Copy Markdown
Collaborator

mahibi commented May 13, 2026

I rebased on master and fixed the merge conflicts.

The PR can be merged as it works and will improve UX.

However this AI review found things that should be investigated further (Could you please have a closer look and create followup PR's if necessary @rapterjet2004 ?):

  • Bug – openWhenDownloadState is semantically broken for concurrent downloads

    The single shared openWhenDownloadState is computed as: "is any downloading file currently visible?". Every download worker started via downloadAndOpenFile receives a reference to this same state object. With two concurrent downloads:

    • File A is downloading, not visible → A is added to downloadingFileState
    • File B is also downloading and visible → openWhenDownloadState.value = true
    • File A finishes → checks openWhenDownloadState.value → it's true (because B is visible) → A opens unexpectedly

    The original per-message boolean was captured at tap time (when the message was visible) and held independently per download — this replacement breaks that isolation.

  • Bug – SharedItemsViewHolder.trueState lifetime is wrong

    SharedItemsViewHolder.kt:62:
    val trueState = mutableStateOf(true)
    This mutableStateOf is created inside bind(), so it's recreated fresh every time the ViewHolder is recycled and rebound. If a download is in progress and the ViewHolder is rebound (user scrolls away and back), the download worker holds a stale reference to the old trueState, while
    resumeToUpdateViewsByProgress registers on the new one — the two are now disconnected.

@mahibi mahibi added this to the 24.0.0 milestone May 13, 2026
@mahibi
Copy link
Copy Markdown
Collaborator

mahibi commented May 13, 2026

improvements for the future:

@mahibi mahibi merged commit af319a8 into master May 13, 2026
13 of 18 checks passed
@mahibi mahibi deleted the issue-6068-reimpl-download-progress branch May 13, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reimplement Download progress

2 participants