Skip to content

Show file upload progress and placeholder media message in chat. - #6327

Draft
mahibi wants to merge 3 commits into
masterfrom
upload-placeholder
Draft

Show file upload progress and placeholder media message in chat.#6327
mahibi wants to merge 3 commits into
masterfrom
upload-placeholder

Conversation

@mahibi

@mahibi mahibi commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

resolve #2375

copied the PR #6047 from @anakin78z to the nextcloud repo as he won't find the time to continue.
I will

  • first try to resolve the conflicts
  • and whenever time allows continue implementation.

Thank you @anakin78z for this initial code!

馃弫 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?)

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/27197628252/artifacts/7504764435
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
mahibi force-pushed the upload-placeholder branch from 9e857a9 to 43b3d2d Compare August 7, 2026 09:32
@mahibi mahibi self-assigned this Aug 7, 2026
@mahibi

mahibi commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

rebased on master and fixed conflicts. Will pick it up whenever time allows

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/31166324927/artifacts/8989488940
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)

anakin78z and others added 3 commits August 8, 2026 21:16
Signed-off-by: Jens Zalzala <jens@shakingearthdigital.com>

# Conflicts:
#	gradle/verification-keyring.keys
App compiles but the upload progress is buggy

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
  Bundles the fixes and follow-up polish for the upload-progress/placeholder
  feature from the recent merge-conflict cleanup:

  Correctness fixes:
  - UploadAndShareFilesWorker called shareFile() unconditionally after every
    successful upload, even though two other paths already share the file
    themselves: ChunkedFileUploader still had a leftover
    ShareOperationWorker.shareFile() call, so any chunked upload (files >1MB)
    without conversation subfolders posted the attachment twice; and
    conversation-subfolder uploads already share via postConversationAttachment,
    so the extra call tried to share a path the file was never uploaded to,
    failed, and incorrectly marked successful uploads as FAILED.
  - uploadUsingConversationSubfolders() sent a freshly generated UUID as the
    message's referenceId instead of the placeholder's actual referenceId, so
    the server echoed back the wrong id and the temp placeholder could never
    be matched against the real incoming message, leaving it stuck forever.
  - sendUnsentChatMessages() (resend-on-reconnect) picked up FAILED upload
    placeholders and reposted their "{file}" sentinel text as a bogus new
    message. Placeholders with a file attachment are now excluded from that
    resend path.
  - The "upload completed" signal that triggers an immediate message refetch
    was commented out, so a successfully uploaded video's placeholder could
    spin forever until the chat was closed and reopened.
  - Coil's AsyncImage never showed a composable-supplied fallback painter when
    passed a pre-built ImageRequest with null data, so previews without a
    server URL (e.g. video with no server preview) silently fell back to
    Coil's own null-data handling instead of our local first-frame image.

  Reliability:
  - UploadAndShareFilesWorker now retries transient network failures (socket
    resets, timeouts) with backoff and a network-connected constraint instead
    of failing immediately, up to a bounded number of attempts.

  UI/UX:
  - Replaced the linear upload progress bar with a WhatsApp-style circular
    spinner overlay (with cancel button) centered on the thumbnail, and fixed
    a metadata-layout bug that left a padding gap next to the placeholder.
  - Removed the persistent Android notifications duplicating in-chat upload/
    compression progress; kept the upload-failed notification.
  - Stopped treating a file's name as its caption; only real captions are
    shown, matching how sent messages already behave.
  - Sized the video upload placeholder to the video's real aspect ratio
    (16:9 fallback) instead of collapsing to a small generic icon.
  - Added a local-first-frame fallback, cached to disk keyed by referenceId,
    for videos whose server preview is unavailable, so they don't show a
    generic icon indefinitely.
  - The play button overlay now shows on all video messages (not just ones
    with a server preview) with a WhatsApp-style semi-transparent dark circle
    behind it.

  Assisted-by: Claude:claude-sonnet-5
@mahibi
mahibi force-pushed the upload-placeholder branch from 43b3d2d to 361a69c Compare August 8, 2026 23:09
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/31283341796/artifacts/9029143403
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)

// 3. It is always positive, because getMessagesEqualOrNewerThan expects it to be larger
// than oldestMessageId
@Suppress("MagicNumber")
val placeholderId = (referenceId.hashCode().toLong() and 0x7FFF_FFFFL)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh, this gave me some headace while testing other branches.
I was wondering why enriching notifications always failed for one conversation.
There was always a followup notification with delete=true which removed the notifiaction on server and enriching resulted in 404.
Same symptom as described in #6330

Apparently i tested the current branch a few days ago and my lastReadMessage was set to 1963726147. So all notifications were immediately deleted, of course also when testing other branches.

  • This placeholderId must be changed!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

show uploading files in conversation

2 participants