openfoodfacts / smooth-app

🤳🥫 The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo
Apache License 2.0
860 stars 286 forks source link

Add a refresh indicator on the product page #5939

Open g123k opened 3 hours ago

g123k commented 3 hours ago

Hi everyone!

In order to be less frustrating for users, I like to show a loading indicator on the product page when changes are being sent. @monsieurtanuki Is there a simple way to know if a product has background tasks? and also to be notified when they're done ? (to remove that indicator)

monsieurtanuki commented 1 hour ago

Fun fact: I somehow asked the same questions exactly 2 years ago, in #3263. Image

In order to be less frustrating for users

Just to understand: what exactly is frustrating?

Is there a simple way to know if a product has background tasks?

I would say something like bool UpToDateChanges.hasNotTerminatedOperations(String barcode) ("Returns true if some actions have not been terminated."). Limited to actions on a single product: OK for details changes, not OK for app language refresh.

also to be notified when they're done ? (to remove that indicator)

As long as you use UpToDateMixin you're notified.

g123k commented 1 hour ago

Fun fact: I somehow asked the same questions exactly 2 years ago, in #3263. Image

In order to be less frustrating for users

Just to understand: what exactly is frustrating?

We have many complaints (app reviews and emails) from users wondering: "What is going on?" "I don't understand why my changes are not visible" "Are my changes lost?"

Displaying the info on the product page is just a small step. The real one would be to add a loader to each piece of info that is being uploaded (similar to what's done with images).

Is there a simple way to know if a product has background tasks?

I would say something like bool UpToDateChanges.hasNotTerminatedOperations(String barcode) ("Returns true if some actions have not been terminated."). Limited to actions on a single product: OK for details changes, not OK for app language refresh.

Ok perfect 👌, tkx

also to be notified when they're done ? (to remove that indicator)

As long as you use UpToDateMixin you're notified.

monsieurtanuki commented 59 minutes ago

We have many complaints (app reviews and emails) from users wondering: "What is going on?" "I don't understand why my changes are not visible" "Are my changes lost?"

Just in case you've never used the app, the changes are visible in the app IMMEDIATELY, even offline. The complaints are probably more triggered by the "locked" data effects (local changes visible in the app then server download erases the changes locally). There's work currently being done about locked fields as you know, cf. https://github.com/openfoodfacts/openfoodfacts-dart/pull/1000.

That said, the side-effects are that the server is momentarily out of sync and that data computed by the server (e.g. scores) don't show immediately in the app.