capacitor-firebase icon indicating copy to clipboard operation
capacitor-firebase copied to clipboard

feat(firestore): Include "metadata" property on snapshot

Open wibimaster opened this issue 1 year ago • 3 comments

Plugin(s)

  • [ ] Analytics
  • [ ] App
  • [ ] App Check
  • [ ] Authentication
  • [ ] Crashlytics
  • [X] Cloud Firestore
  • [ ] Cloud Messaging
  • [ ] Cloud Storage
  • [ ] Performance
  • [ ] Remote Config

Current problem

Firestore SDK permits to save data offline and persist online when connection is active. It let us know when the data is saved offline or online.

This Capacitor plugin doesn't have this option.

Preferred solution

Official documentation (web, swift, java) : https://firebase.google.com/docs/firestore/manage-data/enable-offline?hl=fr#web-modular-api_2

Is it possible to have the same feature on this Capacitor plugin ?

The addCollectionSnapshotListener or addDocumentSnapshotListener could have an option to add metadata property on snapshot result :)

Alternative options

No response

Additional context

No response

Before submitting

  • [X] I have read and followed the feature request guidelines.
  • [X] I have attached links to possibly related issues and discussions.

wibimaster avatar Feb 22 '24 08:02 wibimaster

I close this as duplicate of #467.

robingenz avatar Feb 22 '24 11:02 robingenz

@robingenz That's not really a dup', because it's not the same feature ; #467 is about getDocumentChanges() of the querySnapshot, and #567 is about metadata property of a listener. But you can do both at the same time in #467 :)

wibimaster avatar Feb 26 '24 08:02 wibimaster

Sorry, in this case I keep it open.

robingenz avatar Feb 26 '24 09:02 robingenz

+1 from me. Would be great to have this feature. 😊

phjardas avatar Aug 27 '24 19:08 phjardas

I've drawn a sketch of how the interface could look like, however I'm a bit hesitant to touch the corresponding native code.

phjardas avatar Aug 27 '24 20:08 phjardas

@phjardas Thank you for the inspiration! I would change a few types, see https://github.com/capawesome-team/capacitor-firebase/pull/705. Maybe I'll get to the native implementation this weekend. But you are welcome to try it and create a PR against https://github.com/capawesome-team/capacitor-firebase/tree/feat/issue-567.

robingenz avatar Aug 28 '24 05:08 robingenz