1
0

feat(GODT-2554): Compute telemetry availability from API UserSettings.

This commit is contained in:
Romain Le Jeune
2023-04-13 08:06:48 +00:00
parent c7ae239350
commit 3928ed08f6
7 changed files with 88 additions and 0 deletions

View File

@ -591,6 +591,16 @@ func (user *User) Close() {
}
}
// IsTelemetryEnabled check if the telemetry is enabled or disabled for this user.
func (user *User) IsTelemetryEnabled(ctx context.Context) bool {
settings, err := user.client.GetUserSettings(ctx)
if err != nil {
user.log.WithError(err).Warn("Failed to retrieve API user Settings")
return false
}
return settings.Telemetry == proton.SettingEnabled
}
// initUpdateCh initializes the user's update channels in the given address mode.
// It is assumed that user.apiAddrs and user.updateCh are already locked.
func (user *User) initUpdateCh(mode vault.AddressMode) {