Hey there,
I'm having an Issue on iOS Devices where the available device storage is low.
When the user is Logging in, using Firebase Auth, it works successfully. But when he leaves the app, then some time passes, and opens the app again the session is lost. This can happen multiple times a day.
I think the root cause is, that iOS is deleting the Caches Folder when the available device storage is low:
<Application_Home>/Library/Caches directoryMy Ionic Cordova Application uses the
Web SDK of Firebase so the Data is saved in
IndexedDb in the WebView which is put into the
Caches folder.
When running in a native app context, Storage will prioritize using SQLite, as it's one of the most stable and widely used file-based databases, and avoids some of the pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such data in low disk-space situations.
My Problem now is, that i don't have control over where the Firebase Web SDK is saving the data.
So I'm thinking about the following alternatives:
Getting hold of the User Token and save it in SQLite (preferred way)
-> I can get hold of the refreshToken, but apparently there is no way to log in with it other than implementing my
own Login Mechanism
Backing Up IndexedDb
-> I thought about "backing up" the data in IndexedDb when the user has logged in, and restoring it on App start up when necessary, but that is not as easy as it was with localstorage.
(Seems like that was the solution
here)
Overwriting the window API of IndexedDb to write into SQLite:
-> Seems like a massive Task
So i'm wondering what i can do at this point.
I would be thankful for any suggestions!