forked from Silverfish/proton-bridge
feat(GODT-2555): add local telemetry settings.
feat(GODT-2555): add 'TelemetryDisabled' settings to vault. feat(GODT-2555): CLI and GUI implementation. feat(GODT-2555): implemented setting in bridge-gui-tester. feat(GODT-2555): added unit tests. feat(GODT-2555): feature tests.
This commit is contained in:
@ -184,6 +184,18 @@ func (vault *Vault) SetAutoUpdate(autoUpdate bool) error {
|
||||
})
|
||||
}
|
||||
|
||||
// GetTelemetryDisabled checks whether telemetry is disabled.
|
||||
func (vault *Vault) GetTelemetryDisabled() bool {
|
||||
return vault.get().Settings.TelemetryDisabled
|
||||
}
|
||||
|
||||
// SetTelemetryDisabled sets whether telemetry is disabled.
|
||||
func (vault *Vault) SetTelemetryDisabled(telemetryDisabled bool) error {
|
||||
return vault.mod(func(data *Data) {
|
||||
data.Settings.TelemetryDisabled = telemetryDisabled
|
||||
})
|
||||
}
|
||||
|
||||
// GetLastVersion returns the last version of the bridge that was run.
|
||||
func (vault *Vault) GetLastVersion() *semver.Version {
|
||||
return semver.MustParse(vault.get().Settings.LastVersion)
|
||||
|
||||
@ -153,6 +153,20 @@ func TestVault_Settings_ShowAllMail(t *testing.T) {
|
||||
require.Equal(t, false, s.GetShowAllMail())
|
||||
}
|
||||
|
||||
func TestVault_Settings_TelemetryDisabled(t *testing.T) {
|
||||
// create a new test vault.
|
||||
s := newVault(t)
|
||||
|
||||
// Check the default show all mail setting.
|
||||
require.Equal(t, false, s.GetTelemetryDisabled())
|
||||
|
||||
// Modify the show all mail setting.
|
||||
require.NoError(t, s.SetTelemetryDisabled(true))
|
||||
|
||||
// Check the new show all mail setting.
|
||||
require.Equal(t, true, s.GetTelemetryDisabled())
|
||||
}
|
||||
|
||||
func TestVault_Settings_Autostart(t *testing.T) {
|
||||
// create a new test vault.
|
||||
s := newVault(t)
|
||||
|
||||
@ -36,11 +36,12 @@ type Settings struct {
|
||||
UpdateChannel updater.Channel
|
||||
UpdateRollout float64
|
||||
|
||||
ColorScheme string
|
||||
ProxyAllowed bool
|
||||
ShowAllMail bool
|
||||
Autostart bool
|
||||
AutoUpdate bool
|
||||
ColorScheme string
|
||||
ProxyAllowed bool
|
||||
ShowAllMail bool
|
||||
Autostart bool
|
||||
AutoUpdate bool
|
||||
TelemetryDisabled bool
|
||||
|
||||
LastVersion string
|
||||
FirstStart bool
|
||||
@ -85,11 +86,12 @@ func newDefaultSettings(gluonDir string) Settings {
|
||||
UpdateChannel: updater.DefaultUpdateChannel,
|
||||
UpdateRollout: rand.Float64(), //nolint:gosec
|
||||
|
||||
ColorScheme: "",
|
||||
ProxyAllowed: false,
|
||||
ShowAllMail: true,
|
||||
Autostart: true,
|
||||
AutoUpdate: true,
|
||||
ColorScheme: "",
|
||||
ProxyAllowed: false,
|
||||
ShowAllMail: true,
|
||||
Autostart: true,
|
||||
AutoUpdate: true,
|
||||
TelemetryDisabled: false,
|
||||
|
||||
LastVersion: "0.0.0",
|
||||
FirstStart: true,
|
||||
|
||||
Reference in New Issue
Block a user