smooth-app
smooth-app copied to clipboard
fix: Background image upload
What
- An initial implementation of using
workmanager
to do image upload in the background
Benefits
- Background image upload
- upload completes whenever there is good internet
- once upload scheduled , will retry for five times before finally giving up
- Task remains even when phone starts or app closed
Problems
- can't easily manage app state when using
workmanager
[WIP] alternate ways to let users know if the task is done(possibly other menus) - ios setup is still not configured,(yet to be done,)
Fixes bug(s)
- Fixes: #1593 #2192 #2459
Part of
- #1393
Codecov Report
Merging #2433 (eba8d96) into develop (ac19a9c) will decrease coverage by
0.16%
. The diff coverage is0.47%
.
@@ Coverage Diff @@
## develop #2433 +/- ##
==========================================
- Coverage 7.04% 6.88% -0.17%
==========================================
Files 219 221 +2
Lines 10874 11161 +287
==========================================
+ Hits 766 768 +2
- Misses 10108 10393 +285
Impacted Files | Coverage Δ | |
---|---|---|
...th_app/lib/cards/data_cards/image_upload_card.dart | 0.00% <0.00%> (ø) |
|
...oth_app/lib/data_models/continuous_scan_model.dart | 0.83% <0.00%> (ø) |
|
...h_app/lib/data_models/onboarding_data_product.dart | 0.00% <0.00%> (ø) |
|
.../smooth_app/lib/data_models/onboarding_loader.dart | 0.00% <ø> (ø) |
|
...p/lib/generic_lib/dialogs/smooth_alert_dialog.dart | 15.70% <ø> (ø) |
|
...smooth_app/lib/generic_lib/duration_constants.dart | 0.00% <0.00%> (ø) |
|
...smooth_app/lib/helpers/background_task_helper.dart | 0.00% <0.00%> (ø) |
|
...smooth_app/lib/helpers/picture_capture_helper.dart | 0.00% <0.00%> (ø) |
|
...e_panel/knowledge_panels/knowledge_panel_page.dart | 0.00% <ø> (ø) |
|
packages/smooth_app/lib/main.dart | 14.52% <0.00%> (-0.13%) |
:arrow_down: |
... and 18 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
@monsieurtanuki ,
I'm not convinced by the increasing delay (what delay is that btw? the delay from the moment I clicked on upload or from the latest unsuccessful attempt?). I guess a call to sentry would make sense ("hey we've got this guy and we cannot upload his picture"), as would an alert to the end-user.
the task will immediatly try to do the execution in the background, if it fails then the retry will be done accordingly( a retry feat suggested by eduoard)
Wouldn't it be nice to display somewhere the list of the pending tasks? How do you refresh the app when the picture is uploaded? I saw something about the carousel, but I don't think it would refresh a product page, would it?
WIll do for sure, it's kinda hard to acess database in the work manager, looking and testing workaround for that
@g123k
Had fixed everything for now, works like a charm on my android 11
Blocking is the ios configuration
for it, android didn't required any
If you could look at the ios part of this https://github.com/fluttercommunity/flutter_workmanager/blob/main/IOS_SETUP.md
@M123-dev Thanks for the detailed review, now the code looks better after formating
When I understood the code right (its a mobile review) when I upload an image it takes 30 seconds to first start the real uploading right
We don't have a local instant copy. Together with the 30sec delay, this isn't really user-friendly.
- Zero second delay if there is working internet, or as soon as internet is connected
- When adding a new product we have a placeholder product, but for other purposes sadly no, (Upcoming) Working on an offline tasks screen where one can see the pending tasks.
Offline images do not seem properly credited: https://world.openfoodfacts.org/product/3760262110882
Offline images do not seem properly credited: https://world.openfoodfacts.org/product/3760262110882
Edit:
Fixed the problem
There is lot of ongoing here, so in turn i did the pr as draft, also there is some problem regarding background work policy on ios. At last Eduoard is working on some custom packages for something to do sperately do tasks on ios and android. FOR NOW THE PR IS HALTED 🥲
@AshAman999 Can we solve the merge conflicts now before they become too bad ?
@teolemon, Probably I will need to rewrite this, so nothing to worry I guess, Anyways I will solve the merge conflicts, just in case after the plugin luckily if I don't have to change much.
are there any outstanding issues left @AshAman999 @g123k ?
are there any outstanding issues left @AshAman999 @g123k ?
@teolemon Though as of now, nothing is blocking, but still, I was thinking to create an internal release with the pr to have things tested out before we finally merge it to develop. @g123k ?
Ok, going to merge