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:
@ -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() {
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user