-
Notifications
You must be signed in to change notification settings - Fork 586
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
Implement User/App listener #4522
Conversation
f0815d5
to
5f66dce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not completed review yet, just submitting a few comments
using CallbackTokenPair = std::pair<Protected<typename T::Function>, AppToken>; | ||
std::forward_list<CallbackTokenPair> m_notification_tokens; | ||
|
||
SharedApp m_app; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you conclude that trying to extend shared_ptr
directly was leading to issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having issues that went away by implementing it with a member. That being said, it's possible that it could work extending the shared_ptr
directly. Maybe a second look would be worthwhile, but this time using ->get()
to retrieve a reference to app
instead of dereferencing directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That didn't work the way I had hoped. Found some reading on inheriting shared_ptr
though..
https://stackoverflow.com/a/30309840/192046
I just had a quick look so far. It looks like a couple of files were committed by accident:
Now that we're adding to the Realm JS types, do you plan to extend Realm Web with this as well? Possibly in a follow up PR? Perhaps we need to revisit the scope to clarify that? A heads up: Porting this to v11 will most likely involve the use of the NotificationBucket API that we introduced for all other things that are observable. |
@kraenhansen I do not have |
This should be applied to everything then (objects, collections, realm), and should be planned. |
6462afa
to
ea7dc6f
Compare
It already has been implemented for the other observables. |
Then I will have to make a second PR for the v11 branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, just a few small comments
77c40d7
to
89beeb2
Compare
Add a member variable to store listener tokens to app and user. Store the shared pointer to app and user as a member variable on User and App classes to ensure that the tokens are moved correctly and not copied. Write tests for app listener.
Co-authored-by: Tom Duncalf <[email protected]>
Co-authored-by: Kenneth Geisshirt <[email protected]> Co-authored-by: Tom Duncalf <[email protected]>
89beeb2
to
86c6320
Compare
* Refactored NotificationBucket to take a Token type * Using NotificationBucket for App and User
Co-authored-by: FFranck <[email protected]>
Co-authored-by: FFranck <[email protected]>
618b2e8
to
448de72
Compare
What, How & Why?
Add change listener for app and user
Write tests for app listener.
This closes #4455
☑️ ToDos
Compatibility
label is updated or copied from previous entryBreaking
label has been applied or is not necessaryIf this PR adds or changes public API's: