diff --git a/packages/common/infra/src/atom/settings.ts b/packages/common/infra/src/atom/settings.ts index 6c411d637b..60c64d5bd3 100644 --- a/packages/common/infra/src/atom/settings.ts +++ b/packages/common/infra/src/atom/settings.ts @@ -32,6 +32,7 @@ export type AppSetting = { autoCheckUpdate: boolean; autoDownloadUpdate: boolean; enableMultiView: boolean; + enableTelemetry: boolean; editorFlags: Partial>; }; export const windowFrameStyleOptions: AppSetting['windowFrameStyle'][] = [ @@ -71,6 +72,7 @@ const appSettingBaseAtom = atomWithStorage('affine-settings', { enableNoisyBackground: true, autoCheckUpdate: true, autoDownloadUpdate: true, + enableTelemetry: true, enableMultiView: false, editorFlags: {}, }); diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/index.tsx index ba9e864fb8..c51a488fcc 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/index.tsx @@ -9,6 +9,7 @@ import { useCallback } from 'react'; import { useAppSettingHelper } from '../../../../../hooks/affine/use-app-setting-helper'; import { appIconMap, appNames } from '../../../../../pages/open-app'; +import { mixpanel } from '../../../../../utils'; import { relatedLinks } from './config'; import * as styles from './style.css'; import { UpdateCheckSection } from './update-check-section'; @@ -37,6 +38,18 @@ export const AboutAffine = () => { [toggleAutoDownload, updateSettings] ); + const onSwitchTelemetry = useCallback( + (checked: boolean) => { + if (!checked) { + mixpanel.opt_out_tracking(); + } else { + mixpanel.opt_in_tracking(); + } + updateSettings('enableTelemetry', checked); + }, + [updateSettings] + ); + return ( <> { ) : null} + + + $t(New Doc) button to create your first doc.",