EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 445 forks source link

Update data when offline #961

Open GrEg00z opened 5 years ago

GrEg00z commented 5 years ago

On iOS and Android, when the internet connection is offline, then the promise "setValue" and "update" method are never resolved, until internet connection is back.

But problem is I don't want to wait for the connection, I just want my promise been resolved even without internet, and let firebase do the rest...

Only reading data seems to work during offline

I have the persist mode enabled.

This behaviour is normal ? Or what I have to do to make it works ?

Thanks

GrEg00z commented 5 years ago

Up please !! Nobody have solutions ?

ivanff commented 5 years ago

up, same

EddyVerbruggen commented 5 years ago

So what do you suggest?

GrEg00z commented 5 years ago

I suggest to resolve the promises "setValue" and "update", even without internet connection.

From the doc, it said that with persistent mode activated, all operations sended to firebase are putted in a queue, and then sync to firebase when the connection backs : here

I dont know how it can be complicated to implement this in the nativescript plugin, but I can help you to find it out if you need

GrEg00z commented 4 years ago

any news about this ?

EddyVerbruggen commented 4 years ago

This issue has actually been open as a tab in my browser since your previous comment, but I have not yet found the time to work on it.

GrEg00z commented 4 years ago

No prob, if I get the time too I will try to work on it and fork you some code

RioBautista commented 4 years ago

I also noticed that the cached data doesn't seem to get updated after a setValue when the app is offline contrary to the actual Firebase SDK's behaviour. Eddy even showed that firebase capability during the recent webinar :). I understand an offline write should update the local cache at least and update the listeners.