diff --git a/app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.java b/app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.java index 3f1e2a7c..ba968d38 100644 --- a/app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.java +++ b/app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.java @@ -197,6 +197,7 @@ private void initializeEngineConfigSwitches() { binding.switchDisableFirewall.setChecked(goPreferences.getDisableFirewall()); binding.switchAllowSsh.setChecked(goPreferences.getServerSSHAllowed()); binding.switchBlockInbound.setChecked(goPreferences.getBlockInbound()); + binding.switchLazyConnection.setChecked(goPreferences.getLazyConnectionEnabled()); // Set up change listeners binding.switchDisableClientRoutes.setOnCheckedChangeListener((buttonView, isChecked) -> { @@ -252,15 +253,28 @@ private void initializeEngineConfigSwitches() { Log.e(LOGTAG, "Failed to set block inbound", e); } }); - + + binding.switchLazyConnection.setOnCheckedChangeListener((buttonView, isChecked) -> { + try { + goPreferences.setLazyConnectionEnabled(isChecked); + goPreferences.commit(); + } catch (Exception e) { + Log.e(LOGTAG, "Failed to set lazy connection", e); + } + }); + // Make parent layouts clickable to toggle switches (for TV remote) binding.layoutAllowSsh.setOnClickListener(v -> { binding.switchAllowSsh.toggle(); }); - + binding.layoutBlockInbound.setOnClickListener(v -> { binding.switchBlockInbound.toggle(); }); + + binding.layoutLazyConnection.setOnClickListener(v -> { + binding.switchLazyConnection.toggle(); + }); binding.layoutDisableClientRoutes.setOnClickListener(v -> { binding.switchDisableClientRoutes.toggle(); diff --git a/app/src/main/res/layout/fragment_advanced.xml b/app/src/main/res/layout/fragment_advanced.xml index ad46aea4..082f918e 100644 --- a/app/src/main/res/layout/fragment_advanced.xml +++ b/app/src/main/res/layout/fragment_advanced.xml @@ -268,7 +268,7 @@ + + + + + + + + + + + + + + Allows SSH connections to this device Block inbound connections Blocks all inbound connections to this device and routed networks. This overrides any policies received from the management service + Lazy connection + Defer per-peer connection setup until first actual traffic. Reduces background load but adds latency to the first packet to a peer NetBird logo