CodeLanka / ez-net-app

EZ Net is an application developed for rural internet users which are not tech savy and shows interest in the internet and the resources it has.
MIT License
15 stars 29 forks source link

Images are not cached after fetching from Firebase. #44

Open TheLukaszNs opened 6 years ago

TheLukaszNs commented 6 years ago

What's the problem?

It takes some time for the app to fetch images from Firebase. But it's really annoying to wait for it when launching EzNet - ALWAYS. We should cache images to fetch them only one time or after updates.

How to fix it?

We can fix it by editing Api.js's getThumbnail method to store/cache thumbnails in device storage. I'll get on this in the next days

vibhavagarwal5 commented 6 years ago

I would like to take up this issue.

agentmilindu commented 6 years ago

@vibhavagarwal5 Please proceed.

vibhavagarwal5 commented 6 years ago

What i observed in this problem was that even if you want to cache it you need a storage. You can use AsyncStorage for it, but that still will take some time to load. But one advantage of using it would be that every time you open the app, right now, it fetches from the web but by using AsyncStorage you would now fetch it offline also.
So what AsyncStorage would solve for you is cache all whole JSON(that you create from the firebase data) offline. But still you would need to wait a bit for the app to load from the the AsyncStorage.