chore(core): add telemetry switch (#6267)
This commit is contained in:
@@ -32,6 +32,7 @@ export type AppSetting = {
|
|||||||
autoCheckUpdate: boolean;
|
autoCheckUpdate: boolean;
|
||||||
autoDownloadUpdate: boolean;
|
autoDownloadUpdate: boolean;
|
||||||
enableMultiView: boolean;
|
enableMultiView: boolean;
|
||||||
|
enableTelemetry: boolean;
|
||||||
editorFlags: Partial<Omit<BlockSuiteFlags, 'readonly'>>;
|
editorFlags: Partial<Omit<BlockSuiteFlags, 'readonly'>>;
|
||||||
};
|
};
|
||||||
export const windowFrameStyleOptions: AppSetting['windowFrameStyle'][] = [
|
export const windowFrameStyleOptions: AppSetting['windowFrameStyle'][] = [
|
||||||
@@ -71,6 +72,7 @@ const appSettingBaseAtom = atomWithStorage<AppSetting>('affine-settings', {
|
|||||||
enableNoisyBackground: true,
|
enableNoisyBackground: true,
|
||||||
autoCheckUpdate: true,
|
autoCheckUpdate: true,
|
||||||
autoDownloadUpdate: true,
|
autoDownloadUpdate: true,
|
||||||
|
enableTelemetry: true,
|
||||||
enableMultiView: false,
|
enableMultiView: false,
|
||||||
editorFlags: {},
|
editorFlags: {},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { useCallback } from 'react';
|
|||||||
|
|
||||||
import { useAppSettingHelper } from '../../../../../hooks/affine/use-app-setting-helper';
|
import { useAppSettingHelper } from '../../../../../hooks/affine/use-app-setting-helper';
|
||||||
import { appIconMap, appNames } from '../../../../../pages/open-app';
|
import { appIconMap, appNames } from '../../../../../pages/open-app';
|
||||||
|
import { mixpanel } from '../../../../../utils';
|
||||||
import { relatedLinks } from './config';
|
import { relatedLinks } from './config';
|
||||||
import * as styles from './style.css';
|
import * as styles from './style.css';
|
||||||
import { UpdateCheckSection } from './update-check-section';
|
import { UpdateCheckSection } from './update-check-section';
|
||||||
@@ -37,6 +38,18 @@ export const AboutAffine = () => {
|
|||||||
[toggleAutoDownload, updateSettings]
|
[toggleAutoDownload, updateSettings]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const onSwitchTelemetry = useCallback(
|
||||||
|
(checked: boolean) => {
|
||||||
|
if (!checked) {
|
||||||
|
mixpanel.opt_out_tracking();
|
||||||
|
} else {
|
||||||
|
mixpanel.opt_in_tracking();
|
||||||
|
}
|
||||||
|
updateSettings('enableTelemetry', checked);
|
||||||
|
},
|
||||||
|
[updateSettings]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SettingHeader
|
<SettingHeader
|
||||||
@@ -91,6 +104,15 @@ export const AboutAffine = () => {
|
|||||||
</SettingRow>
|
</SettingRow>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
<SettingRow
|
||||||
|
name={t['com.affine.telemetry.enable']()}
|
||||||
|
desc={t['com.affine.telemetry.enable.desc']()}
|
||||||
|
>
|
||||||
|
<Switch
|
||||||
|
checked={appSettings.enableTelemetry}
|
||||||
|
onChange={onSwitchTelemetry}
|
||||||
|
/>
|
||||||
|
</SettingRow>
|
||||||
</SettingWrapper>
|
</SettingWrapper>
|
||||||
<SettingWrapper title={t['com.affine.aboutAFFiNE.contact.title']()}>
|
<SettingWrapper title={t['com.affine.aboutAFFiNE.contact.title']()}>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -1118,6 +1118,8 @@
|
|||||||
"com.affine.workspaceType.offline": "Available Offline",
|
"com.affine.workspaceType.offline": "Available Offline",
|
||||||
"com.affine.write_with_a_blank_page": "Write with a blank page",
|
"com.affine.write_with_a_blank_page": "Write with a blank page",
|
||||||
"com.affine.yesterday": "Yesterday",
|
"com.affine.yesterday": "Yesterday",
|
||||||
|
"com.affine.telemetry.enable": "Enable Telemetry",
|
||||||
|
"com.affine.telemetry.enable.desc": "Telemetry is a feature that allows us to collect data on how you use the app. This data helps us improve the app and provide better features.",
|
||||||
"core": "core",
|
"core": "core",
|
||||||
"dark": "Dark",
|
"dark": "Dark",
|
||||||
"emptyAllPages": "Click on the <1>$t(New Doc)</1> button to create your first doc.",
|
"emptyAllPages": "Click on the <1>$t(New Doc)</1> button to create your first doc.",
|
||||||
|
|||||||
Reference in New Issue
Block a user