Skip to content
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: basic support for sending and stopping live location shares #3741

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

torrybr
Copy link
Contributor

@torrybr torrybr commented Jul 19, 2024

This MR introduces basic functionality for sending and stopping live location shares, as outlined in the Matrix Spec Proposal #3489. This foundational support allows users to share their live location, setting the stage for further enhancements.

Key Changes

  • Live Location Start: Saving and sending an initial beacon_info state event.
  • Live Location Stop: Stopping a users existing beacon_info state event from the state store.

These changes were adapted from a previous MR discussion, available for reference here.

Follow-up

Future MRs will expand on this initial implementation, using a layered approach to fully realize the functionality described in the spec above and align with ongoing community discussions.

This does not send any beacon message events. This MR simply introduces beacon_info support with the intention of follow on MRs to build on this basic functionality.

Signed-off-by: Torry Brelsford tb@brehl.dev

@torrybr torrybr requested a review from a team as a code owner July 19, 2024 15:30
@torrybr torrybr requested review from andybalaam and removed request for a team July 19, 2024 15:30
Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 79.31034% with 6 lines in your changes missing coverage. Please review.

Project coverage is 83.97%. Comparing base (925c5b2) to head (33f58dd).
Report is 34 commits behind head on main.

Files Patch % Lines
crates/matrix-sdk/src/room/mod.rs 82.60% 4 Missing ⚠️
crates/matrix-sdk/src/error.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3741      +/-   ##
==========================================
- Coverage   84.02%   83.97%   -0.06%     
==========================================
  Files         260      260              
  Lines       26712    26725      +13     
==========================================
- Hits        22446    22441       -5     
- Misses       4266     4284      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@torrybr torrybr force-pushed the feat/base-msc3489 branch from 4b8b741 to 2f4abd2 Compare July 19, 2024 18:24
@torrybr torrybr changed the title Basic support for sending and stopping live location shares sdk: basic support for sending and stopping live location shares Jul 19, 2024
@andybalaam
Copy link
Member

Thanks @torrybr please could you sign this off in the PR or commits?

Also it looks like there is a conflict to resolve. I'm happy for you to rebase and force push to resolve this.

In the meantime I will begin trying to understand this PR to review it.

@andybalaam
Copy link
Member

I'm happy for you to rebase and force push to resolve this.

Or feel free to leave the merge commit if you prefer. It looks like we will want to squash at the end so either will be fine.

Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking very nice! Just a few changes I am suggesting. @bnjbvr if you have time to do a quick check over, even better.

Cargo.lock Outdated Show resolved Hide resolved
crates/matrix-sdk-base/src/store/integration_tests.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-base/src/store/integration_tests.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-base/src/store/integration_tests.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-base/src/store/integration_tests.rs Outdated Show resolved Hide resolved
.mount(&server)
.await;

mock_sync(&server, &*LIVE_LOCATION_SHARING_SYNC, None).await;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth having all this hard-coded JSON? Maybe just adding the beacon_info as we do in the previous test and then stopping it would be adequate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to this. If we could inline the JSON here too, that'd be great.

Copy link
Contributor Author

@torrybr torrybr Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After calling room.start_live_location(), how do I resync so that the state store has the beacon_info I need to test? I'm looking for guidance on setting up the mock_sync without using &*LIVE_LOCATION_SHARING_SYNC. This will help me get the other tests in correct shape as well. Any examples would be very helpful! Below is simple example of what im trying to achieve

Updated the start_live_location_share to make use of inline JSON for the sync + check the store for correct saving. Let me know if this is the direction you were thinking and I will update the stop_live_location_test to be more comprehensive. Could I combine these into 1 test (start_and_stop_live_location_share or do you prefer they are separate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I combine these into 1 test (start_and_stop_live_location_share or do you prefer they are separate?

I will always recommend separate tests, one for each thing you are testing. It makes it much easier to understand the test, and, critically for me, it makes it easier to see what has gone wrong if a test fails in future.

Feel free to share e.g. test setup code by putting it in a function or even a TestSetup struct if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with comprehensive testing, I can take a second pass to try a TestSetup if desired

@bnjbvr bnjbvr self-requested a review July 22, 2024 15:01
@torrybr torrybr force-pushed the feat/base-msc3489 branch 2 times, most recently from 91e91e9 to 5ddd6fd Compare July 22, 2024 22:00
bnjbvr
bnjbvr previously requested changes Jul 23, 2024
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting!

crates/matrix-sdk-base/src/rooms/mod.rs Show resolved Hide resolved
crates/matrix-sdk-base/src/store/integration_tests.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-base/src/store/integration_tests.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-base/src/store/integration_tests.rs Outdated Show resolved Hide resolved
.mount(&server)
.await;

mock_sync(&server, &*LIVE_LOCATION_SHARING_SYNC, None).await;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to this. If we could inline the JSON here too, that'd be great.

@torrybr torrybr force-pushed the feat/base-msc3489 branch 3 times, most recently from 6ae1932 to ffa4d48 Compare July 23, 2024 21:30
@andybalaam
Copy link
Member

Thanks @torrybr please could you sign this off in the PR or commits?

I don't see the full "Signed-off-by" line in the PR description. See https://github.com/matrix-org/matrix-rust-sdk/blob/main/CONTRIBUTING.md#sign-off and do ask if you have questions.

@torrybr torrybr force-pushed the feat/base-msc3489 branch from ffd8e34 to 9b742fd Compare July 24, 2024 14:09
@bnjbvr bnjbvr dismissed their stale review July 25, 2024 08:28

holidays

Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more tiny comments, but looking good.

We also need sign-off in the description.

crates/matrix-sdk/tests/integration/room/joined.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/tests/integration/room/joined.rs Outdated Show resolved Hide resolved
@torrybr torrybr force-pushed the feat/base-msc3489 branch from a604eb3 to 35231ea Compare July 25, 2024 16:19
@torrybr torrybr force-pushed the feat/base-msc3489 branch from aba5797 to 33f58dd Compare July 25, 2024 16:47
@torrybr
Copy link
Contributor Author

torrybr commented Jul 25, 2024

Signed off and ready for final review 👍

@torrybr torrybr requested a review from andybalaam July 25, 2024 17:19
Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you for all your work on this.

@andybalaam andybalaam merged commit 5bbe022 into matrix-org:main Jul 26, 2024
40 checks passed
@torrybr torrybr mentioned this pull request Sep 4, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants