Show file upload progress and placeholder media message in chat.#6047
Show file upload progress and placeholder media message in chat.#6047anakin78z wants to merge 1 commit intonextcloud:masterfrom
Conversation
7978ebe to
8261f43
Compare
|
Glad to see works that build on to of the recent changes (yes it makes sense to start with a fresh approach instead the old approach for chatkit). Please let us know if there are any questions or it is ready to review. |
|
Hey @anakin78z , thank you for the PR. I will take a look at this PR soon. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
|
Hello @anakin78z - could you rebase on the latest master and resolve merge conflicts? To resolve linter issues, please run ./gradlew ktlintFormat. |
d6e3f69 to
a542193
Compare
|
@sowjanyakch merge conflict fixed & linter issues resolved. |
sowjanyakch
left a comment
There was a problem hiding this comment.
I tested this PR with different scenarios and noticed an issue.
Start uploading a video file and then disconnect the device from Wi-Fi. As expected, the upload fails and a “Failure” warning is shown. However, after reconnecting to Wi-Fi, a progress bar appears again, which gives the impression that the upload is being retried.
But the upload is not retried, and after sometime "{file}" message is posted in the chat. To make this behavior clearer, we could either retry the upload when the network is restored, or avoid showing the placeholder message and instead display a clear failure state in the case of failed file upload — for example, a snackbar indicating that the file upload has failed.
Btw, for NC34 - the file upload implementation changes and use new API's for the same #6127 and it is currently under review.
| remotePath, | ||
| metaData | ||
| ) | ||
| FileUtils.copyFileToCache(context, sourceFileUri, fileName) |
There was a problem hiding this comment.
@sowjanyakch While testing the issue with resuming uploads, I ran into an issue here, where it couldn't copy the file to cache because there wasn't enough disk space.
java.io.IOException: write failed: ENOSPC (No space left on device)
I don't really understand why we're copying the file after the upload is complete? If you could shed some light on that, I would appreciate it.
If the copy is necessary, we'll have to add a check here or in FileUtils to handle the exception.
@sowjanyakch The {file} message is actually coming from the server: Receiving : okhttp3.internal.ws.RealWebSocket@1de6f4e {"type":"event","event":{"target":"room","type":"message","message":{"roomid":"7tbeykxa","data":{"type":"chat","chat":{"comment":{"id":3649,"token":"7tbeykxa","actorType":"users","actorId":"devjens","actorDisplayName":"Dev Jens","timestamp":1777486849,"message":"{file}","messageParameters":[],"systemMessage":"","messageType":"comment","isReplyable":true,"referenceId":"a51e6407006543ea94bd7754f2844fd3","reactions":{},"expirationTimestamp":0,"markdown":true,"threadId":3649}}}}}}It looks like the server stores the message even if the file upload fails. We could catch this by looking for {file} messages with no file attachments, but we'd then have to show some kind of error message. I'm not sure if this changes with the new API? Can you link me to the documentation, please? |
a542193 to
a3141b3
Compare
Signed-off-by: Jens Zalzala <jens@shakingearthdigital.com> # Conflicts: # gradle/verification-keyring.keys
a3141b3 to
75e9f18
Compare
Implements #2375
I'm aware of the work in progress at #5317 but I couldn't get it to work when I tried it, and since there were a lot of changes with the ChatKit removal, I thought it best to start fresh.
🖼️ Screen captures:
The X button in the top right cancels the upload.
Uploading images are blurred to indicate they are not yet fully sent (they remain blurred until the device receives the chat message from the server). The idea is to make it obvious that the messages can't be interacted with as a regular media message.
Video demo:
https://youtube.com/shorts/FMw_yvhxXL4
🚧 ISSUES
I created issue #6081 for the following. It will be fixed once #6124 is merged:
After a file has uploaded, but before the insurance request is made, tapping the image/video fails. While investigating this, I noticed that the return values from the WebSocket and the insurance request are different:

The link and path parameters both have different values. I'm not sure if this is a server issue, or if the responses need to be handled differently, but it's odd that the link would be different.
My server version is 33.0.0
🏁 Checklist
/backport to stable-xx.x