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:
Xavier Michelon
2023-04-18 11:10:16 +02:00
parent c000ee8a3c
commit f4631c4bc9
29 changed files with 1700 additions and 1039 deletions

View File

@ -289,6 +289,23 @@ func New(
})
fe.AddCmd(badEventCmd)
// Telemetry commands
telemetryCmd := &ishell.Cmd{
Name: "telemetry",
Help: "choose whether usage diagnostics are collected or not",
}
telemetryCmd.AddCmd(&ishell.Cmd{
Name: "enable",
Help: "Usage diagnostics collection will be enabled",
Func: fe.enableTelemetry,
})
telemetryCmd.AddCmd(&ishell.Cmd{
Name: "disable",
Help: "Usage diagnostics collection will be disabled",
Func: fe.disableTelemetry,
})
fe.AddCmd(telemetryCmd)
go fe.watchEvents(eventCh)
go func() {

View File

@ -195,6 +195,38 @@ func (f *frontendCLI) showAllMail(c *ishell.Context) {
}
}
func (f *frontendCLI) enableTelemetry(_ *ishell.Context) {
if !f.bridge.GetTelemetryDisabled() {
f.Println("Usage diagnostics collection is enabled.")
return
}
f.Println("Usage diagnostics collection is disabled right now.")
if f.yesNoQuestion("Do you want to enable usage diagnostics collection") {
if err := f.bridge.SetTelemetryDisabled(false); err != nil {
f.printAndLogError(err)
return
}
}
}
func (f *frontendCLI) disableTelemetry(_ *ishell.Context) {
if f.bridge.GetTelemetryDisabled() {
f.Println("Usage diagnostics collection is disabled.")
return
}
f.Println("Usage diagnostics collection is enabled right now.")
if f.yesNoQuestion("Do you want to disable usage diagnostics collection") {
if err := f.bridge.SetTelemetryDisabled(true); err != nil {
f.printAndLogError(err)
return
}
}
}
func (f *frontendCLI) setGluonLocation(c *ishell.Context) {
if gluonDir := f.bridge.GetGluonCacheDir(); gluonDir != "" {
f.Println("The current message cache location is:", gluonDir)