[client] expose LazyConnectionEnabled in Android Preferences bridge#5994
[client] expose LazyConnectionEnabled in Android Preferences bridge#5994MichaelUray wants to merge 1 commit intonetbirdio:mainfrom
Conversation
Mirrors the existing BlockInbound bridge: the new GetLazyConnectionEnabled / SetLazyConnectionEnabled methods read/write the field via the same configInput-buffer-then-Commit pattern, so the Android UI can manage the LazyConnectionEnabled setting that the engine already understands.
📝 WalkthroughWalkthroughTwo new accessor methods are added to the Android Preferences struct for managing a "lazy-connection" setting. The getter retrieves the cached value or loads from config, while the setter updates the in-memory field pending the existing commit operation. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
The companion UI change consuming these bridge methods is filed at netbirdio/android-client#171. |



Describe your changes
Adds two methods to the Android
Preferencesbridge so the Android UI can read and write the existingLazyConnectionEnabledengine setting:GetLazyConnectionEnabled() (bool, error)SetLazyConnectionEnabled(enabled bool)The implementation mirrors the adjacent
BlockInboundbridge: it returns the in-memoryconfigInputvalue first if set, otherwise falls back to reading the persisted config; the setter buffers the value inconfigInputand waits forCommit().Issue ticket number and link
N/A — bridge addition only, no behavior change in the engine.
Checklist
Documentation
Select exactly one:
This is an internal Go-mobile bridge addition with no user-facing surface in this repo. The
LazyConnectionEnabledsetting itself is already honored by the engine and presumably already documented at the engine level. The Android UI that consumes these methods is filed at netbirdio/android-client#171; if user docs are needed for the toggle, they belong with that UI change.Docs PR URL (required if "docs added" is checked)
N/A.
Notes
LazyConnectionEnabledfield already exists inclient/internal/profilemanager/config.goand is honored by the engine; this change only exposes it through the gomobile bridge.go build ./client/android/...andgo test ./client/android/...(existing tests pass; no new test added because the new methods are pure passthroughs to the well-testedconfigInput/ReadConfig/UpdateOrCreateConfigcode paths). Tested end-to-end on a Galaxy S21 (Android 15) — toggle in the Android UI persistsLazyConnectionEnabledto the config file and the engine activates the lazy-connection manager (setup lazy connection service, per-peer activity listeners on 127.0.0.1:N, 15-minute inactivity threshold) as expected.