talk-android icon indicating copy to clipboard operation
talk-android copied to clipboard

[DRAFT] Implements file upload progress

Open ariedov opened this issue 3 months ago • 13 comments

This is the most basic implementation of the file upload progress feature.

It contains:

  1. DB update and migration
  2. Flows between the dao-repository-viewmodel
  3. A TextView to display the updates on the screen

ariedov avatar Sep 02 '25 12:09 ariedov

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!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

github-actions[bot] avatar Sep 17 '25 02:09 github-actions[bot]

Thank you @ariedov and sorry i found no time to have a look (release is upcoming etc..). However before diving into a review i have the problem that i can't build the branch. @ariedov are you able to build this branch?

I get this error:

Execution failed for task ':app:kaptGplayDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to generate a Build Scan (Powered by Develocity).
> Get more help at https://help.gradle.org.
Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptGplayDebugKotlin'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:135)
....
Caused by: java.lang.reflect.InvocationTargetException
	at org.jetbrains.kotlin.kapt.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:98)
	at org.jetbrains.kotlin.kapt.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:37)
	at org.jetbrains.kotlin.kapt.base.Kapt.kapt(Kapt.kt:46)
	... 30 more
Caused by: java.lang.NullPointerException

It took me a while but then i remembered i had the same problem in the past. I think the cause of this is that you are trying to inject a DAO inside a worker. I had the same situation when i wanted to create a worker to send temporary messages (which i never did yet because of this problem), see the comment

It may be easier to switch from Dagger to Hilt before, as injecting a Dao into a worker with dagger is ugly.

in https://github.com/nextcloud/talk-android/issues/4596

I think my comment back then was strongly influenced by this article: https://medium.com/android-news/injecting-into-workers-android-workmanager-and-dagger-948193c17684

So it seems it is possible with Dagger but i absolutely did not like the solution.

As you are the second dev now who took this pitfall, we should try to find a solution. @ariedov Let me know if you want to take a look or if i should do.

Also @tobiasKaminsky may have an opinion as you offered help back then in #4596

mahibi avatar Sep 22 '25 13:09 mahibi

Hey! Thanks for taking a look. I did build the branch and kinda got it to work. Will look into this.

ariedov avatar Sep 22 '25 15:09 ariedov

Hey! Thanks for taking a look. I did build the branch and kinda got it to work. Will look into this.

ok that's interesting. Could you share some setup details? Android Studio version and Gradle JDK (Preferences -> Build -> Build Tools -> Gradle -> Gradle JDK)

Does it still work when you clean the build beforehand (Build - Clean project)?

mahibi avatar Sep 22 '25 15:09 mahibi

Took me ~1h, but finally found it. But stracktrace, debug, logs, all were not helpful. In the end I opened all changed files one by one to check for IDE reporting problems. And then it turned out that ChatActivity had 2x companion object…

tobiasKaminsky avatar Sep 24 '25 14:09 tobiasKaminsky

Thanks @tobiasKaminsky now it builds again. @ariedov i just tried if it builds and saw that currently the pollng polling is broken. This is because handleUploadsFromDb is blocking at the moment. To solve, for example it's content should be wrapped by

scope.launch {

}

Also, during the first test i did not see progress for the text view (it was null 0.0). I can have a closer look next week. Otherwise just let me know if you want to change anything beforehand. Thanks again for your efforts!

mahibi avatar Oct 02 '25 14:10 mahibi

Thank you very much for fixing the build and spending some effort on this! I am extremely out of time, unfortunately, at the moment, so I cannot promise to spend much time on this anytime soon.

Sorry for leaving this one in a half-baked state. I'll do my best to try to pick up the slack as soon as I can.

ariedov avatar Oct 02 '25 15:10 ariedov

Thank you very much for fixing the build and spending some effort on this! I am extremely out of time, unfortunately, at the moment, so I cannot promise to spend much time on this anytime soon.

Sorry for leaving this one in a half-baked state. I'll do my best to try to pick up the slack as soon as I can.

All fine @ariedov , we appreciate your efforts! If at any time you feel like you are not able to continue with the PR at all, just let us know if we should take over. Otherwise we are happy to help!

mahibi avatar Oct 06 '25 13:10 mahibi

Hi @ariedov do you plan pick this up again or should me or me colleagues take over?

mahibi avatar Dec 08 '25 12:12 mahibi

Hey @mahibi , sorry for the silence. Please feel free to take over.

ariedov avatar Dec 08 '25 12:12 ariedov

Hey @mahibi , sorry for the silence. Please feel free to take over.

No worries. Thanks to let me know and thanks again for your efforts! I rebased for now. We will pick it up when time allows! If you change your mind and would like to continue just let us know.

mahibi avatar Dec 09 '25 15:12 mahibi

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/5317.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 app.

github-actions[bot] avatar Dec 09 '25 15:12 github-actions[bot]

Codacy

Lint

TypemasterPR
Warnings9999
Errors00

SpotBugs

CategoryBaseNew
Bad practice66
Correctness1010
Dodgy code5454
Internationalization33
Malicious code vulnerability33
Performance44
Security11
Total8181

github-actions[bot] avatar Dec 09 '25 15:12 github-actions[bot]