lantern-core: centralize ApplyUserDataToSettings + extend to purchase paths#8805
Open
myleshorton wants to merge 1 commit into
Open
lantern-core: centralize ApplyUserDataToSettings + extend to purchase paths#8805myleshorton wants to merge 1 commit into
myleshorton wants to merge 1 commit into
Conversation
…paths Consolidates the per-platform applyUserDataToSettings helper introduced on this branch into a single exported function in lantern-core/core.go, removing the duplicate copies from lantern-core/mobile/mobile.go and lantern-core/ffi/ffi.go. Also wires it into the purchase / restore flows (AcknowledgeGooglePurchase, AcknowledgeApplePurchase, restoreSubscription) so account-switching purchases propagate the full identity (user_level, email, jwt_token) through PatchSettings rather than relying on radiance's internal setData, which only writes the caller's in-process settings cache and doesn't reach the canonical store the system extension reads. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes the post-identity-change settings propagation logic into a single lanterncore.ApplyUserDataToSettings helper, and ensures purchase/restore flows also update the canonical settings store after server-side account switching (closing a remaining macOS two-process settings drift gap).
Changes:
- Moved duplicated
applyUserDataToSettingsimplementations from mobile + FFI layers intolantern-core/core.goas exportedApplyUserDataToSettings. - Updated mobile + FFI identity-changing entry points (Login/OAuth callback/Logout/DeleteAccount) to call the centralized helper.
- Extended the same “patch canonical settings” behavior to cross-account purchase acknowledgements and restore-subscription account switches on mobile.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lantern-core/mobile/mobile.go | Removes local helper, uses centralized helper, and applies it after cross-account purchase/restore flows. |
| lantern-core/ffi/ffi.go | Removes local helper and switches identity-changing calls to use the centralized helper. |
| lantern-core/core.go | Introduces exported ApplyUserDataToSettings to patch canonical settings from account.UserData. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Stacked on top of #8804.
What
applyUserDataToSettingshelper (added per-platform in lantern-core: propagate identity to settings on Login/Logout/OAuth/DeleteAccount (mobile + FFI) #8804) into a single exportedlanterncore.ApplyUserDataToSettingsinlantern-core/core.go, and drop the duplicate copies fromlantern-core/mobile/mobile.goandlantern-core/ffi/ffi.go.AcknowledgeGooglePurchaseAcknowledgeApplePurchaserestoreSubscription(only when the server returns a differentActualUserID)Why
#8804 fixed the Pro-server-list-collapse bug for Login / OAuthLoginCallback / Logout / DeleteAccount, but a small residual hole remained: when a purchase or a
restoreSubscriptioncauses radiance to switch accounts, only the in-processsetDataruns. On the macOS two-process build, that doesn't reach the canonicalsettings.jsonthe network-extension config fetcher reads from, so/v1/config-newrequests can briefly continue to advertise the pre-switch identity. Routing the post-switch identity update throughPatchSettings(same path the rest of the purchase code already uses for tier/expiration) closes the gap and matches the post-Login behavior introduced in #8804.The centralization makes it harder to drift mobile and ffi out of sync as more identity-changing entry points get added.
Verification
go vet ./lantern-core/...— cleango build ./lantern-core/...— cleango test ./lantern-core/...— passesIdentity-changing entry points covered after this PR:
🤖 Generated with Claude Code