-
Notifications
You must be signed in to change notification settings - Fork 246
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
sdk: add support for listening to stream of live location updates #4025
base: main
Are you sure you want to change the base?
Conversation
last_location: LastLocation { | ||
location: event.content.location, | ||
ts: event.content.ts, | ||
}, |
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'm having trouble adding beacon_info
to the struct with self.get_user_beacon_info()
due to borrowed data issues. I'm still learning the nuances of Rust tasks.
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.
Do you still have troubles?
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.
Yes, I'm having trouble integrating the beacon_info
into my struct, which contains information about the sender, timeout, and is_live()
. I've commented out beacon_info
in the struct until I can better understand how to include it.
Each user sharing their live location in a room is stored here. My idea is to, on every beacon
update, retrieve the related beacon_info
and send it to the receiver. This is why I updated get_user_beacon_info
to obtain beacon_info
based on the sender.
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.
Is it the caller's responsibility to retrieve the beacon_info
based on the user ID provided in the LiveLocationShare
struct, or should this function handle the retrieval of beacon_info
as part of the event processing?
Seems that the test aren't particularly happy with this PR. Can you please have a look? |
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.
Thanks for the PR. I've left some feedback that can impact the global design of your patch.
3b574dd
to
7066fb3
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4025 +/- ##
==========================================
+ Coverage 84.15% 84.16% +0.01%
==========================================
Files 266 266
Lines 28461 28474 +13
==========================================
+ Hits 23950 23964 +14
+ Misses 4511 4510 -1 ☔ View full report in Codecov by Sentry. |
// /// Information about the associated beacon event (currently commented out). | ||
// pub beacon_info: BeaconInfoEventContent, |
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.
Why did you comment these lines?
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.
See #4025 (comment) above
/// | ||
/// # Errors | ||
/// | ||
/// Returns an error if the event is redacted, stripped, not found or could | ||
/// not be deserialized. | ||
async fn get_user_beacon_info( | ||
&self, | ||
user_id: &UserId, |
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.
Why are you adding the user_id
argument here? You're using the method the same way by passing Self::own_user_id()
anyway. Moreover, I'm not sure it's possible to get the beacon info for another user within a client.
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.
See #4025 (comment) above
last_location: LastLocation { | ||
location: event.content.location, | ||
ts: event.content.ts, | ||
}, |
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.
Do you still have troubles?
Conversation related to this issue can be found here
This merge request adds
subscribe_to_live_location_shares
to thematrix_sdk::Room
that allows clients to listen for beacon updates using a background task. The method provides an easy way to subscribe to live location sharing events within a room, handling event processing internally.Follow-up tasks will include adding support for the event cache.