I'd like to use Ionic 4 + Firestore to provide app with offline and live sync capability.
Target deploy to Native App (iOS, Android), electron App (Windows and Mac), PWA.
Is firestore local cache persistent in hybrid app? What type of storage firestore cache using? Will it be something like localstorage, which will be delete by android / iOS from time to time / while low storage.
I'm testing with below code and did enablePersistence, offline mode is working just fine. But it seem that the the it count all documents read per app launch. Example, I'm having 100 documents.
a. While app first launch, it should count as 100 read as it sync all data to local cache.
b. While 2nd time I launch the app, assume, no document was updated, it shouldn't count any read right?
c. Because from my monitoring, the read count increase every time I launch the app.
d. Will it be any possible like, no document was updated, but my code force to fetch data from server then it consume the read count?
Thanks.
getChatMessages(groupId) {
return this.db.collection(`groups/${groupId}/messages`, ref => ref.orderBy('createdAt')).snapshotChanges().pipe(
map(actions => actions.map(a => {
const data = a.payload.doc.data();
const id = a.payload.doc.id;
return { id, ...data };
}))
);
}