diff --git a/client/android/preferences.go b/client/android/preferences.go index c3c8eb3fbc9..26687ec8386 100644 --- a/client/android/preferences.go +++ b/client/android/preferences.go @@ -307,6 +307,24 @@ func (p *Preferences) SetBlockInbound(block bool) { p.configInput.BlockInbound = &block } +// GetLazyConnectionEnabled reads the lazy-connection setting from the config file +func (p *Preferences) GetLazyConnectionEnabled() (bool, error) { + if p.configInput.LazyConnectionEnabled != nil { + return *p.configInput.LazyConnectionEnabled, nil + } + + cfg, err := profilemanager.ReadConfig(p.configInput.ConfigPath) + if err != nil { + return false, err + } + return cfg.LazyConnectionEnabled, err +} + +// SetLazyConnectionEnabled stores the given value and waits for commit +func (p *Preferences) SetLazyConnectionEnabled(enabled bool) { + p.configInput.LazyConnectionEnabled = &enabled +} + // Commit writes out the changes to the config file func (p *Preferences) Commit() error { _, err := profilemanager.UpdateOrCreateConfig(p.configInput)