-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firebase remote config fetch failure causes WifiDetailsRepoImpl
not to return default or cached values for wifi details
#72
Comments
Will check on this and see the best possible way to handle it with your suggestion in mind |
We could also use kotlin Flow to first emit the cached data then (in the background) refresh the cached data by fetching and emit the data again if it changes. This way even if the fetch fails the UI will already contain the cached data
|
@johnGachihi Anyway to reproduce the said error? |
Disconnect your phone from internet |
Okay will test this and get back to you |
On this case, am trying to investigate why it's not loading the default values in case of an error at the very least. |
RemoteConfig doesn't work sometimes. I have faced this issue before. |
Okay we can go with what @johnGachihi is suggesting |
Haha. Flow to the rescue once again. |
Here are my thoughts on the implementation on EventTypeViewModel. I think the
Or what was your thinking in making it to be this way? |
Without it, the method |
Yes am aware of that #73 is aimed at improving that and avoid the methods being called on fragment recreation. Thank you for your clarification! |
Sorry, closed it by mistake |
I have re-done the TravelFragment Remote config architecture, with what we were following previously with the app and it works without showing the error. Seems the problem is with your implementation bit. Let me do re-write and see if the error persists |
@johnGachihi Latest commit fixes the issue |
@wangerekaharun, in |
I noticed that when a firebase remote config (frc) fetch fails in
WifiDetailsRepoImpl
, instead of falling back to and returning the default or cached frc wifi details, FirebaseResult.error() is returned.This happens because the
await()
ext. function throws an exception whenever the fetch fails. And since it is wrapped inrunCatching
, aFirebaseResult.error()
is returned.Ideally, whenever an frc fetch fails, the frc defaults or cached values should be returned.
My approach to solve this would be to wrap this in a try-catch like so:
so that even when the fetch fails this will be called
WifiDetailsModelFactory.create(firebaseRemoteConfig)
and return the default or cached values
The text was updated successfully, but these errors were encountered: