Skip to content

[client] expose LazyConnectionEnabled in Android Preferences bridge#5994

Open
MichaelUray wants to merge 1 commit intonetbirdio:mainfrom
MichaelUray:feat/android-lazy-connection-toggle-upstream
Open

[client] expose LazyConnectionEnabled in Android Preferences bridge#5994
MichaelUray wants to merge 1 commit intonetbirdio:mainfrom
MichaelUray:feat/android-lazy-connection-toggle-upstream

Conversation

@MichaelUray
Copy link
Copy Markdown
Contributor

@MichaelUray MichaelUray commented Apr 25, 2026

Describe your changes

Adds two methods to the Android Preferences bridge so the Android UI can read and write the existing LazyConnectionEnabled engine setting:

  • GetLazyConnectionEnabled() (bool, error)
  • SetLazyConnectionEnabled(enabled bool)

The implementation mirrors the adjacent BlockInbound bridge: it returns the in-memory configInput value first if set, otherwise falls back to reading the persisted config; the setter buffers the value in configInput and waits for Commit().

Issue ticket number and link

N/A — bridge addition only, no behavior change in the engine.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

This is an internal Go-mobile bridge addition with no user-facing surface in this repo. The LazyConnectionEnabled setting 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

  • The LazyConnectionEnabled field already exists in client/internal/profilemanager/config.go and is honored by the engine; this change only exposes it through the gomobile bridge.
  • Companion UI work that consumes these methods is filed at Add Lazy connection toggle to Advanced settings android-client#171.
  • Verified locally with go build ./client/android/... and go test ./client/android/... (existing tests pass; no new test added because the new methods are pure passthroughs to the well-tested configInput / ReadConfig / UpdateOrCreateConfig code paths). Tested end-to-end on a Galaxy S21 (Android 15) — toggle in the Android UI persists LazyConnectionEnabled to 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.

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.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 25, 2026

📝 Walkthrough

Walkthrough

Two 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

Cohort / File(s) Summary
Lazy Connection Preference Accessors
client/android/preferences.go
Added GetLazyConnectionEnabled() and SetLazyConnectionEnabled() methods following the existing pattern for preference getters and setters, supporting the lazy-connection configuration option.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • pappz

Poem

Lazy hops through Android lands so fair, 🐰
A preference blooms with gentle care,
Get and set with patterns tried and true,
Connection settings fresh and new! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: exposing LazyConnectionEnabled in the Android Preferences bridge, which matches the changeset's primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description is well-structured and follows the template, including all required sections: changes description, issue reference, checklist selection, CLA confirmation, and documentation explanation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

@MichaelUray
Copy link
Copy Markdown
Contributor Author

The companion UI change consuming these bridge methods is filed at netbirdio/android-client#171.

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.

1 participant