Repository navigation
Conversation
The expiries of the live location shares are needed independently of the session displayed in the UI, to resume or stop the shares of every session. Extract them from the session-scoped LiveLocationStore into the app-scoped LiveLocationExpiryStore. Both stores use the same DataStore file, so no migration is needed. LiveLocationStore only keeps the disclaimer flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pure rename, no behavior change. The next commit turns this class into the app-scoped engine owning the live location shares of every session; renaming it first lets the diff of that commit show how the logic evolves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ession The live location manager was session-scoped, but the session graph is recreated when switching account: the previous manager of the session kept running, and could unregister the new one from the coordinator, so the other shares of the session stopped receiving locations. LiveLocationShareEngine now lives as long as the application and keeps all the shares started on this device, keyed by session and room. It also takes over the role of LiveLocationSharingCoordinator: it starts the live location service when the first share starts and stops it when the last one ends, throttles the location updates and sends them to every share. LiveLocationSharingCoordinator and LiveLocationReceiver are removed. The resources of a session (beacon updates listener, timeouts) are bound to the scope of its MatrixClient, so they are released with the client. A share is only dropped by a beacon update matching its beacon, so the late echo of a stopped beacon cannot stop another share. ActiveLiveLocationShareManager is now a stateless view of the engine for a session (SessionActiveLiveLocationShareManager). Remove setup() from the API, the engine needs no initialisation from the UI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The persisted shares were only restored when the UI of their session was displayed, so the shares of the other accounts were not resumed after the process had been killed. Restore the shares of every session when the app starts, using an AppStartupHook, and when the system restarts the sticky live location service. The service now stops itself if there is nothing to share, instead of keeping the location updates and the notification running without any share. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The engine is app-scoped, so it registers a single SessionListener. When a session is deleted, release its resources and forget its shares and persisted data. The shares cannot be stopped on the server anymore, the session is gone. Also guard the restoration against a failure to read the sessions, and complete the documentation of ActiveShare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #8312 +/- ##
===========================================
+ Coverage 81.03% 81.05% +0.01%
===========================================
Files 2903 2905 +2
Lines 87386 87427 +41
Branches 11891 11899 +8
===========================================
+ Hits 70814 70862 +48
+ Misses 11930 11925 -5
+ Partials 4642 4640 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Rename SessionActiveLiveLocationShareManager to DefaultActiveLiveLocationShareManager, to follow the naming convention of the classes contributing a binding, and make ActiveShare a data class. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… restored The live location engine can restore a session at startup before RootFlowNode restores the saved state. restoreWithSavedState then returned early because the cache was not empty, and the other saved sessions were missing when the node graph was restored. Restore every saved session which is not in the cache yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix races between restoring, starting and stopping shares, keep shares which may still be live on the server, detect remote stops, and avoid crashing the service when it cannot enter the foreground. Start the service directly when sharing starts instead of relying on isSharing observers, and only stop the shares once when errors are reported concurrently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Content
Live location sharing is now owned by a single app-scoped
LiveLocationShareEngine, which keeps every share started on this device, keyed by session and room.ActiveLiveLocationShareManager, used by the presenters, is now implemented by a new, statelessDefaultActiveLiveLocationShareManager: a session-scoped view of the engine for one session.The engine:
MatrixClient;AppStartupHook) and when the system restarts the sticky service;The previous
DefaultActiveLiveLocationShareManager, which held the state, is renamed toLiveLocationShareEngineand changed in place. The newDefaultActiveLiveLocationShareManagerreuses its name, as required by the Konsist naming rule for@ContributesBindingclasses, but only forwards to the engine.LiveLocationSharingCoordinatorandLiveLocationReceiverare removed, and the engine takes over their role.setup()is removed fromActiveLiveLocationShareManagerand fromLoggedInFlowNode. The persisted expiries move to an app-scopedLiveLocationExpiryStore, which uses the same DataStore files, so no migration is needed.Reviewing: please review commit by commit. The second commit is a pure rename, so the third one shows how the manager logic evolved into the engine. The last commit only fixes detekt and Konsist issues. In the whole-branch diff, the engine appears as a new file. This is one PR with several commits rather than several PRs, which is why it goes over the 500-line guideline for production code (about +615/−447).
Motivation and context
The manager was
@SingleIn(SessionScope). The session graph is created by the UI and rebuilt each time the user switches account, but a live location share has to outlive the UI and the account on screen. Consequences (the first one is confirmed on a real device):SessionListener.Screenshots / GIFs
No UI change.
Tests
Unit tests:
LiveLocationShareEngineTest(20 tests, covering two accounts sharing at once, rooms not affecting each other, remote stop and replacement, expiry, restore, session deletion) andLiveLocationExpiryStoreTest.Manual, with two accounts A and B:
adb shell am kill). Reopen the app: A's share resumes without opening A.Tested devices
Checklist
/code-reviewrun in a fresh session) before requesting a human review.🤖 Generated with Claude Code