mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
chore(core): add telemetry switch (#6267)
This commit is contained in:
@@ -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 (
|
||||
<>
|
||||
<SettingHeader
|
||||
@@ -91,6 +104,15 @@ export const AboutAffine = () => {
|
||||
</SettingRow>
|
||||
</>
|
||||
) : null}
|
||||
<SettingRow
|
||||
name={t['com.affine.telemetry.enable']()}
|
||||
desc={t['com.affine.telemetry.enable.desc']()}
|
||||
>
|
||||
<Switch
|
||||
checked={appSettings.enableTelemetry}
|
||||
onChange={onSwitchTelemetry}
|
||||
/>
|
||||
</SettingRow>
|
||||
</SettingWrapper>
|
||||
<SettingWrapper title={t['com.affine.aboutAFFiNE.contact.title']()}>
|
||||
<a
|
||||
|
||||
Reference in New Issue
Block a user