feat: enable telemetry toggle button

This commit is contained in:
liyasthomas
2021-07-07 06:30:49 +05:30
parent 7b3dd697bb
commit 20d38e247b
5 changed files with 22 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ type SettingsCustomDimensions = {
syncHistory: boolean syncHistory: boolean
usesBg: HoppBgColor usesBg: HoppBgColor
usesAccent: HoppAccentColor usesAccent: HoppAccentColor
usesTelemetry: boolean
} }
type HoppRequestEvent = type HoppRequestEvent =
@@ -54,6 +55,7 @@ function initSettingsListeners() {
syncHistory: settings.syncHistory, syncHistory: settings.syncHistory,
usesAccent: settings.THEME_COLOR, usesAccent: settings.THEME_COLOR,
usesBg: settings.BG_COLOR, usesBg: settings.BG_COLOR,
usesTelemetry: settings.TELEMETRY_ENABLED,
} }
analytics.setUserProperties(conf) analytics.setUserProperties(conf)

View File

@@ -339,5 +339,6 @@
"hide_sidebar": "Hide sidebar", "hide_sidebar": "Hide sidebar",
"show_sidebar": "Show sidebar", "show_sidebar": "Show sidebar",
"protocols": "Protocols", "protocols": "Protocols",
"protocol_count": "protocol {count}" "protocol_count": "protocol {count}",
"telemetry": "Telemetry"
} }

View File

@@ -41,6 +41,7 @@ export type SettingsType = {
} }
THEME_COLOR: HoppAccentColor THEME_COLOR: HoppAccentColor
BG_COLOR: HoppBgColor BG_COLOR: HoppBgColor
TELEMETRY_ENABLED: boolean
} }
export const defaultSettings: SettingsType = { export const defaultSettings: SettingsType = {
@@ -62,6 +63,7 @@ export const defaultSettings: SettingsType = {
}, },
THEME_COLOR: "green", THEME_COLOR: "green",
BG_COLOR: "system", BG_COLOR: "system",
TELEMETRY_ENABLED: true,
} }
const validKeys = Object.keys(defaultSettings) const validKeys = Object.keys(defaultSettings)

View File

@@ -199,6 +199,15 @@
{{ $t("use_experimental_url_bar") }} {{ $t("use_experimental_url_bar") }}
</SmartToggle> </SmartToggle>
</div> </div>
<span>
<SmartToggle
:on="TELEMETRY_ENABLED"
@change="toggleSetting('TELEMETRY_ENABLED')"
>
{{ $t("telemetry") }}
{{ TELEMETRY_ENABLED ? $t("enabled") : $t("disabled") }}
</SmartToggle>
</span>
</div> </div>
</AppSection> </AppSection>
<FirebaseEmail :show="showEmail" @hide-modal="showEmail = false" /> <FirebaseEmail :show="showEmail" @hide-modal="showEmail = false" />
@@ -263,6 +272,8 @@ export default Vue.extend({
SYNC_ENVIRONMENTS: getSettingSubject("syncEnvironments"), SYNC_ENVIRONMENTS: getSettingSubject("syncEnvironments"),
SYNC_HISTORY: getSettingSubject("syncHistory"), SYNC_HISTORY: getSettingSubject("syncHistory"),
TELEMETRY_ENABLED: getSettingSubject("TELEMETRY_ENABLED"),
// Teams feature flag // Teams feature flag
currentBackendUser: currentUserInfo$, currentBackendUser: currentUserInfo$,
currentUser: currentUser$, currentUser: currentUser$,

View File

@@ -34,6 +34,11 @@ export const SETTINGS_KEYS = [
*/ */
"EXTENSIONS_ENABLED", "EXTENSIONS_ENABLED",
/**
* A boolean value indicating whether Telemetry is enabled.
*/
"TELEMETRY_ENABLED",
/** /**
* A boolean value indicating whether to use the URL bar experiments * A boolean value indicating whether to use the URL bar experiments
*/ */