Open dovahkiin98 opened 5 years ago
@dovahkiin98 no, right now there is not. Can you describe your use case? Do you need:
Or something else?
Notifications for when items are added, changes, or removed. But also the ability to get pages, for example, receive each 50 items alone, not the whole block. I'm guessing the only way is to make a custom listener and change the limit dynamically, tho that didn't work well with me in Realtime database.
Can you explain what you mean by "But also the ability to get pages, for example, receive each 50 items alone, not the whole block." ?
Getting all the data at once would take time, I want to be able to take pages instead of all the data. 50 messages a time, then add them to the list. But all the pages are real time. Listening to edits and deletions, while one page is listening to addition. Can the query for the adapter be updated after the items are laid out?
For example: I make the view listen for changes and deletion with a pagination adapter, while a snapshot listener listens for additions. But the pagination adapter isn't real time, so it only reads the data once right? If changes or deletions happen, the adapter won't be notified.
As @dovahkiin98 wrote, it could be great a way to get the best of both worlds.
I would appreciate it if this improvement is made in the future.
At the moment my solution was reload the adapter to my recyclerview.
please check my implementation for real time pagination
https://github.com/RubyLichtenstein/FireCat
@dovahkiin98
@jonthn90 hey, can you explain if you found a solution on how to accomplish this while still using FirestorePagingAdapter?
hi @sabeehshah. This was some time ago so I don't remember exactly how was solve :(. But I remember I implemented the pagination without the Real Time feature. And every time a user adds/removes an item, refresh the adapter to reload all the collection again. This was not the most eficcient but with the pagination don't reload all the colleccion just the number of items that you configurate in your pagination.
For Pagination
Manual implementation
https://firebase.google.com/docs/firestore/query-data/query-cursors
With Firebase UI (I used this)
In the FireStore Adapter, there are 2 options: No paging, and paging. As said, the paging option doesn't offer realtime data, but the no paging option becomes time expensive when the data becomes large in an app like chatting apps.
Is there a way to get the best of both worlds?