Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a ProgressBar to display while uploading Pics/Files #3443

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Smarshal21
Copy link
Member

@Smarshal21 Smarshal21 commented Nov 14, 2023

Resolves #2500

Overview

This pull request introduces a ProgressBar to enhance the user experience during file uploads. The ProgressBar provides visual feedback on the upload progress, making it more intuitive for users.

Changes Made:

Upload Functionality:

  • Modified the upload function to handle ProgressBar visibility.
  • The ProgressBar is set to VISIBLE during the upload process and GONE when the upload is complete.

WorkManager Integration:

  • Utilized WorkManager for managing the background file upload task.
  • Enqueued unique work to ensure proper handling of the upload task.

Observing WorkManager State:

  • Implemented an observer for the WorkManager to track the state of the file upload.
  • The ProgressBar is hidden once the upload is completed, and appropriate notifications are displayed.

🏁 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?)

Copy link
Collaborator

@mahibi mahibi left a comment

Choose a reason for hiding this comment

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

I like the callback approach, however i think the solution is not yet fully developed.

I agree that we need to show the loading progress in the chat, but we should introduce placeholder messages for that, which is a bit more work.

With the current solution, the loading bar now floats above all messages which is a bit irritating, especially when uploads take longer. It is not obvious that it is the upload progress but it feels more like there are problems loading the chat.

@rapterjet2004
Copy link
Contributor

Placeholder messages seem to be necessary for this one. There should be a shimmer effect in place while the file is loading. We're already using this loading library in some of our xml.

We could have it so that when the file message is sent, a temporary placeholder message is added to the chat list, before being removed when the file message arrives from the server.

This also allows us a bit of freedom when it comes to design. We could implement a custom Nextcloud themed loading animation in the future, if we ever need to.

@Smarshal21
Copy link
Member Author

Placeholder messages seem to be necessary for this one. There should be a shimmer effect in place while the file is loading. We're already using this loading library in some of our xml.

We could have it so that when the file message is sent, a temporary placeholder message is added to the chat list, before being removed when the file message arrives from the server.

This also allows us a bit of freedom when it comes to design. We could implement a custom Nextcloud themed loading animation in the future, if we ever need to.

what would be better @mahibi @rapterjet2004 ? use the existing shimmer which appears while loading the chat or a custom shimmer for uploading ?

@mahibi
Copy link
Collaborator

mahibi commented Mar 5, 2024

Placeholder messages seem to be necessary for this one. There should be a shimmer effect in place while the file is loading. We're already using this loading library in some of our xml.
We could have it so that when the file message is sent, a temporary placeholder message is added to the chat list, before being removed when the file message arrives from the server.
This also allows us a bit of freedom when it comes to design. We could implement a custom Nextcloud themed loading animation in the future, if we ever need to.

what would be better @mahibi @rapterjet2004 ? use the existing shimmer which appears while loading the chat or a custom shimmer for uploading ?

i would say a loading circle (spinner) inside a placeholder message.

Fyi i rebased on master and fixed minor merge conflicts

fileUri,
room,
currentConversation?.displayName!!,
metaData
)
) { showProgressBar: Boolean ->
binding.idprogressbar.visibility = if (showProgressBar) View.VISIBLE else View.GONE
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
binding.idprogressbar.visibility = if (showProgressBar) View.VISIBLE else View.GONE
binding.idprogressbar.visibility = if (showProgressBar) View.VISIBLE else {
chatViewModel.refreshChatParams(
setupFieldsForPullChatMessages(
true,
globalLastKnownFutureMessageId,
true
)
)
View.GONE
}

Breaks with the recent refactoring of ChatActivity. Insert this line to fix it, so that uploaded files show up after sending.

Smarshal21 and others added 3 commits March 29, 2024 21:18
Signed-off-by: Smarshal21 <lcb2021048@iiitl.ac.in>

Added ProgressBar

Signed-off-by: Smarshal21 <lcb2021048@iiitl.ac.in>

Added ProgressBar

Signed-off-by: Smarshal21 <lcb2021048@iiitl.ac.in>

added progress bar

Signed-off-by: Smarshal21 <lcb2021048@iiitl.ac.in>
Signed-off-by: Smarshal21 <lcb2021048@iiitl.ac.in>
just rebased to origin/master and fixed some conflicts. Did not test or improve anything.

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

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/3443-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings8181
Errors1010

SpotBugs

CategoryBaseNew
Bad practice66
Correctness88
Dodgy code110110
Internationalization33
Malicious code vulnerability33
Performance66
Security11
Total137137

Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a placeholder/progress bar for uploading pics/files
4 participants