-
Notifications
You must be signed in to change notification settings - Fork 530
Presence: fix live updates on Home & DM list #6145
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
Presence: fix live updates on Home & DM list #6145
Conversation
{ | ||
// Observe contact presence change | ||
MXWeakify(self); | ||
mxDirectUserPresenceObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXKContactManagerMatrixUserPresenceChangeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { |
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.
Would it make sense to pass the directUserId
in as the object
to reduce the number of times this block will get called? As a bonus, if the ID is nil, the observer wouldn't even need to be created.
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.
Unfortunately this doesn't seem to work I suppose it has to be the same object rather than two objects that happen to be equal.
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.
Ah that's a shame, but also seems obvious now you mention it 🤦♂️
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.
Yeah, fundamentally I'd say using the existing notification system seems like the right thing from my perspective.
As a potential alternative for the cell having some logic, would it make sense to extract the listener logic into an object owned by the presence view? It could be more reusable that way and work automatically if the indicator is added elsewhere in the future.
Yeah I suppose this makes sense and would avoid some code repetition as well. |
📱 Scan the QR code below to install the build for this PR. If you can't scan the QR code you can install the build via this link: https://i.diawi.com/kbz5vG |
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.
LGTM 👍
Fixes #6144
Open to discussion around this solution :)
Advantages:
Drawback:
The other solution would require a few changes on both application and SDK, including :
directUserPresence
onMXRoomSummaryMO
so the fetchers can trigger room list updates accordingly