Project: "Add an Offline Mode in OpenFoodFacts Mobile App"
Student | Aman Raj |
---|---|
Organisation | Open Food Facts |
Project | Implement an offline mode for the new Open Food Facts Flutter application |
GitHub | @ashaman999 |
Aman Raj | |
[email protected] | |
Website | https://ashaman999.github.io/ashaman/ |
Hello, I am Aman Raj, I am in my pre-final year the time when I am doing my GSoC, I am from Bihar India. I started contributing to open food facts a while ago, for issues regarding the features I did during my GSoC period, feel free to reach me through my Email or on LinkedIn
- Implementing the Offline Product Save Mechanism
- Offline Edit Mode (Let user modify changes and sync with server when back online)
- Preloading data (Let users load the top 1000 scanned products within their country)
The main goal was somewhat already implemented, my work was mostly to retune the existing way to have a better experience for end users. I did the way to store gzipped data instead of raw JSON to further reduce the size of offline DB to store more products and the user have less disk space usage
The difficult part for me was implementing the offline edit mode, I ended up creating the whole work (using WorkManager) which was working well on Android but failed on iOS. So we had to reinvent the wheel, took help from my mentor Eduoard on this one on working on a plugin using dart isolates to get the work done effectively.
Another interesting part was when preloading data it was kinda hard to work to store a large number of products, but I was able to emit the Knowledge Panels field of the product to further reduce the size of each Product.
- Explored the working of the whole project, the data flow between pages, and how preexisting code works
- Explored more about the dart package of open food facts, learned more about async programming in dart
- Had the first time meeting with one of the most interesting guys around ie my mentors and project maintainers
- Desinged the UI part on figma
- Discussed with mentors how to get the thing done well
-
Added error SVG's in case of internet not conneted #2263
- Now it shows proper SVG's indicating that the images were not loaded cause of internet issues
-
Worked around with help of my mentors to implement background task execution #2433
- A way to edit the fields without blocking the user view, users and edit fields even in low internet connections
- It also solved issues related to the UI being blocked in case of image uploads, the UI is not blocked while image upload, instead it is done separately in the background
- Apart from that now users can edit the products offline and it gets synced with the server when back online
- All tasks/edits persist even on app restarts or even phone restart
- Fixed #1593 #2192 #2459 #1393
-
Compressing Proudct data to reduce space of localdatabase #2524
- Used gzip to compress the JSON before storing it to sqf lite
- Extra care is taken to ensure that the
old uncompressed data
is still readable to the end user - More details here Study the effect of compression algorithms on storage space required for offline products #2447
- Was closed eventually by another refactored PR from one of the maintainers on #2447
-
Better place holder when no internet connection #2560
- Show better icons to further indicate that things didn't load cuz of internet issues
-
Double-response mechanism in the scan screen #2632
- Check for a fresh copy of the product while scanning whenever possible
- Defaults to a timeout of 5 seconds in case of low internet connectivity
-
Added feat in dev mode to preload 1k products #2661
- Let the user preload top 1000 products (Knowledge panels are excluded)
- Currently available only in dev mode
- Will be moved further to onboarding when approved
-
Offline product knowledge panel issue #2693
- When updating database with a fresh copy from the internet don't delete knowledge panels from the existing products
-
Instant refresh views #2901
- Immediately change the product state in the edit screen
- Works even when offline
- Immediate response compared to what was earlier after the offline PR merge
- The changes are stored locally giving users immediate feedback even without an internet connection.
-
Menu to manage offline data #2971
- Let the user manage the cached data
- Ability to update the local database products
- Ability to clean the local cache for freeing up device memory
Since I get to know more about community the better I realized the number of people that are being affected by my work (my first time working on a project being used by thousands). In between the Offline Mode project, I stepped over my responsibilities to fix some ongoing issues in the production to further help the team deliver regular updates with fixed patches and a better experience.
- openfoodfacts/smooth-app#2290
- openfoodfacts/smooth-app#2487
- openfoodfacts/smooth-app#2691
- openfoodfacts/smooth-app#2713
- openfoodfacts/smooth-app#2727
- openfoodfacts/smooth-app#2831
- openfoodfacts/smooth-app#2857
Apart from all these other pull requests, I reviewed a lot of pull requests and connected to the community members. Attended org meetings discussing further improvements.
- Loved the community and going to stay here and enjoy the open source culture, Met really good mentors and organizers, That being said I can say I got what GSoC was intended for ie. loving the way to love doing opensource
- Further fix bugs, look into more features if intended to be implemented