diff --git a/composables/settings/definition.ts b/composables/settings/definition.ts index 9f47e14de0..fa22fce5bf 100644 --- a/composables/settings/definition.ts +++ b/composables/settings/definition.ts @@ -8,6 +8,7 @@ export type OldFontSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' export type ColorMode = 'light' | 'dark' | 'system' export interface PreferencesSettings { + allowGlean: boolean hideAltIndicatorOnPosts: boolean hideBoostCount: boolean hideReplyCount: boolean @@ -60,6 +61,7 @@ export function getDefaultLanguage(languages: string[]) { } export const DEFAULT__PREFERENCES_SETTINGS: PreferencesSettings = { + allowGlean: true, hideAltIndicatorOnPosts: false, hideBoostCount: false, hideReplyCount: false, diff --git a/composables/settings/storage.ts b/composables/settings/storage.ts index a1a543d7a5..b2220d40a8 100644 --- a/composables/settings/storage.ts +++ b/composables/settings/storage.ts @@ -43,5 +43,5 @@ export function getPreferences(userSettings export function togglePreferences(key: keyof PreferencesSettings) { const flag = usePreferences(key) - flag.value = !flag.value + return flag.value = !flag.value } diff --git a/locales/en.json b/locales/en.json index 44baa7eb5e..610982e844 100644 --- a/locales/en.json +++ b/locales/en.json @@ -544,6 +544,12 @@ "zen_mode": "Zen mode", "zen_mode_description": "Hide asides unless the mouse cursor is over them. Also hide some elements from the timeline." }, + "privacy": { + "data_collection": "Data collection and use", + "label": "Privacy", + "opt_out_description": "Allow technical, interaction, campaign and referral data to be sent to Mozilla. With this data you will have a personalized experience.", + "opt_out_title": "Help improve Mozilla Social" + }, "profile": { "appearance": { "bio": "Bio", diff --git a/modules/glean/runtime/glean-plugin.client.ts b/modules/glean/runtime/glean-plugin.client.ts index 9dcdca51d0..96f8e9fe06 100644 --- a/modules/glean/runtime/glean-plugin.client.ts +++ b/modules/glean/runtime/glean-plugin.client.ts @@ -11,10 +11,13 @@ export default defineNuxtPlugin((nuxtApp) => { log.info('Glean: App mounted, start initing glean') const GLEAN_APP_ID = 'mozilla-social-web' - const devMode = useAppConfig().env === ('dev' || 'canary' || 'preview') - const uploadEnabled = devMode // this will eventually be a setting that the user can toggle + const env = useAppConfig().env + const devMode = env === ('dev' || 'canary' || 'preview') + const userSettings = useUserSettings() + const allowGlean = getPreferences(userSettings.value, 'allowGlean') + const uploadEnabled = devMode && allowGlean - Glean.initialize(GLEAN_APP_ID, uploadEnabled, {}) + Glean.initialize(GLEAN_APP_ID, uploadEnabled, { channel: env }) userAgent.set(navigator.userAgent) // Debugging diff --git a/pages/settings.vue b/pages/settings.vue index a84aef9a26..1e7ccb59f6 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -12,6 +12,7 @@ useHydratedHead({ const route = useRoute() const isRootPath = computedEager(() => route.name === 'settings') +const devMode = useAppConfig().env === ('dev' || 'canary' || 'preview')