-
Notifications
You must be signed in to change notification settings - Fork 308
Support observing multiple boxes #59
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
Comments
You can use one of the BoxStore.subscribe() methods to achieve that. Does that work for you? |
Does the method only triggers one time after an transaction with multiple types involved? |
No, it invokes per Class passing the Class as an parameter. |
Ok, what would be the best practice to get all objects from 3 boxes? |
@FabianTerhorst Getting all objects (box.getAll()) or getting notifications? The latter would involve BoxStore.subscribe() and check the class in the callback. The callback is called 3 times for three boxes. If you want just a single call being made, we may consider an additional method to be implemented. In that case it would help to see the use case. If that may be useful for other users, we will consider it. |
@greenrobot i have a list of objects inside an recyclerview, the list is containing 3 different types of objects. |
Thinking about changing the callback to receive a list of changed entity classes... |
If you have an entity with a list of other entities, shouldnt the other entities changing also trigger the parents change? E.g.:
I understand that this makes it far more complex, but a hint on whether you are planning to incorporate it or not would be great! |
which subscribe()? public SubscriptionBuilder subscribe() this one? how to use it? I understood how to subscribe to other class of changes, but I don't know how to subscribe to more than one class of changes at the same time. |
@udyr-woo As I noted in #1204 (comment), your code can use To subscribe to multiple, create multiple subscriptions. You would have to write logic to combine updates from each. |
Maybe support an store.boxFor(Class[]).query()?
The text was updated successfully, but these errors were encountered: