Skip to content

Migrate client state off ObjectBox to Radiance#8447

Open
atavism wants to merge 35 commits intomainfrom
atavism/issue-2944
Open

Migrate client state off ObjectBox to Radiance#8447
atavism wants to merge 35 commits intomainfrom
atavism/issue-2944

Conversation

@atavism
Copy link
Contributor

@atavism atavism commented Feb 5, 2026

Resolves https://github.com/getlantern/engineering/issues/2944

This PR replaces Flutter local DB/local storage reads for user, plans, split-tunneling, private servers, and selected server location with Riverpod providers backed by lantern-core/Radiance APIs (with Go-side on-disk caching)

@jigar-f
Copy link
Contributor

jigar-f commented Feb 5, 2026

@atavism I think this pretty big change, did we remove obejctbox completly? I thought we were just removing private server stuff.

  • With this change, now every time we need adda new local state, we need to add an ffi method and a platform channel against it, before we just did with object box, only one method.
  • With this, now it goes to flutter->ffi/platfomchannel-> go aginest flutter->done

Correct if I'm wrong, I have not looked in detail.

@atavism
Copy link
Contributor Author

atavism commented Feb 5, 2026

@jigar-f Yes, I went ahead and fully removed ObjectBox in this PR. If Radiance is our source of truth for persistent state (user, selected server, split tunneling, etc.), I think we’re better off not keeping a separate Flutter DB. I get the concern about extra FFI/platform-channel calls, but we can keep the surface area small with a few get/set endpoints (and core caching) instead of duplicating state...Does that sound reasonable?

@atavism
Copy link
Contributor Author

atavism commented Feb 5, 2026

For instance, we could expose getAppState / updateAppState instead of one API per field

@jigar-f
Copy link
Contributor

jigar-f commented Feb 6, 2026

Agreed, Radiance should definitely be the source for VPN-related functionality. That said, I don’t think Radiance needs to care whether a user has a plan or not, or whether the user is shown an intro, etc. That logic can probably live elsewhere — though I don’t have a strong opinion against it.

I think we should take the time to test everything thoroughly and make sure all flows are working as expected before merging.
Did you get a chance to test all flows, especially auth and purchase?

@jigar-f
Copy link
Contributor

jigar-f commented Feb 17, 2026

@atavism, sorry, I know thisis on me. I will start reviewing this soon, caught up on someother stuff.

@atavism
Copy link
Contributor Author

atavism commented Feb 18, 2026

No worries, thanks @jigar-f!

@DelaLantern
Copy link

@atavism - is this still awaiting your review?

@jigar-f
Copy link
Contributor

jigar-f commented Mar 5, 2026

@atavism Created PR for follow-up changes #8509 take look when you get chance

jigar-f and others added 4 commits March 9, 2026 07:34
* Sync private server with radiance.

* Add back account updates

* Added support delete server

* Added split tunnling methods

* Remove unused methods

* Remove unused code

* Add with_clash_api,with_conntrack build tags to CI tests (#8510)

The Makefile already uses these tags for all production builds, but
the go.yml CI workflow ran tests without them. This meant conntrack
(connection tracking) was disabled in tests, so code paths like
graceful connection draining were never exercised in CI.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* remove pre-releases sooner and more thoroughly (#8506)

* remove pre-releases sooner and more thoroughly

* allow non-main nightlies, but cleanup the release

* don't make releases for nightly builds, either

* added support for ServerCredential and fixed UI issues

* more update

* OAuth account updates (#8513)

* update delete account flow

* save OAuth provider and map to delete account

* Fixed some more Oauth issues

* Fix issue on while signup using OAuth

* use remote radiance

* update IOS method channel

* Update lantern_generated_bindings.dart

* code review updates

* More improvements

* ran format

* fix animaiton issue

* more imporvements

* fix account issue

* update radiance with OAuth fix

* Fix account delete dialog

* Update en.po

* Match last build version and number

* code review updates (#8514)

---------

Co-authored-by: atavism <atavism@users.noreply.github.com>

* be selective on paths when running ci (#8507)

* centerlize local saving logic

* Remove more unused code

* code review updates

* ran format

* update radiance

* Update ffi.go

* remove duplication.

---------

Co-authored-by: Myles Horton <afisk@getlantern.org>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Jay <110402935+jay-418@users.noreply.github.com>
Co-authored-by: atavism <atavism@users.noreply.github.com>
@atavism
Copy link
Contributor Author

atavism commented Mar 10, 2026

@jigar-f Did you do some testing? Lmk if/when you're comfortable merging this. Thanks!

@jigar-f
Copy link
Contributor

jigar-f commented Mar 10, 2026

@atavism I did a bit of testing, so far it looks good. Still, I like to test a bit more payment stuff, maybe give it 2 more days.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates Flutter-side user/session-related state off of the local ObjectBox DB and onto Riverpod providers backed by lantern-core/Radiance APIs (with Go-side caching), while also adding new private-server and split-tunneling bridging methods across Dart ⇄ native ⇄ Go.

Changes:

  • Removes ObjectBox (deps, generated plugin registrants, entities/mappers) and introduces a SharedPreferences-backed LocalStorageService for lightweight cached settings.
  • Refactors multiple features (plans, server location selection, private servers, split tunneling, user/home) to consume Riverpod providers sourced from lantern-core instead of local DB reads.
  • Adds new private-server and split-tunnel APIs across Go core, FFI exports, and native method-channel handlers.

Reviewed changes

Copilot reviewed 114 out of 119 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
pubspec.yaml / pubspec.lock Removes ObjectBox deps; adds shared_preferences as a direct dependency.
lib/core/services/local_storage_service.dart New SharedPreferences cache wrapper replacing DB reads for settings/plans/location/dev-mode.
lib/core/services/injection_container.dart Switches LocalStorageService to async GetIt singleton registration.
lib/lantern/lantern_platform_service.dart Adds split-tunnel + private-server methods and enabled-apps snapshot refresh logic.
ios/Runner/Handlers/MethodHandler.swift / android/.../MethodHandler.kt / macos/.../MethodHandler.swift Adds/updates method-channel plumbing for new core APIs.
lib/features/private_server/manage_private_server.dart Updates private-server UI to use available servers from core and adds share-key caching.
Comments suppressed due to low confidence (1)

ios/Runner/Handlers/MethodHandler.swift:193

  • The iOS method channel only adds deletePrivateServerByName, but Dart now calls getSplitTunnelItems / getSplitTunnelState (and private-server rename once implemented) via LanternPlatformService. Without adding these cases to the iOS handler, iOS will hit FlutterMethodNotImplemented/MissingPlugin errors at runtime when split-tunneling screens load. Please add the missing method cases and wire them to the new MobileGetSplitTunnelItems, MobileGetSplitTunnelStateJSON, and MobileUpdatePrivateServerName / MobileDeletePrivateServerByName APIs as appropriate.
      case "deletePrivateServerByName":
        guard let name: String = self.decodeValue(from: call.arguments, result: result) else {
          return
        }
        self.deletePrivateServerByName(result: result, name: name)

      // Server Selection
      case "getLanternAvailableServers":
        self.getLanternAvailableServers(result: result)


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@atavism atavism changed the title Sync user data from Radiance in Flutter Migrate client state off ObjectBox to Radiance Mar 10, 2026
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.

5 participants