mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 02:13:00 +08:00
fix(core): runtime control of telemetry (#10663)
This commit is contained in:
@@ -1,4 +1,20 @@
|
||||
import { mixpanel, sentry } from '@affine/track';
|
||||
import { APP_SETTINGS_STORAGE_KEY } from '@toeverything/infra';
|
||||
|
||||
mixpanel.init();
|
||||
sentry.init();
|
||||
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
let enabled = true;
|
||||
const settingsStr = localStorage.getItem(APP_SETTINGS_STORAGE_KEY);
|
||||
|
||||
if (settingsStr) {
|
||||
const parsed = JSON.parse(settingsStr);
|
||||
enabled = parsed.enableTelemetry;
|
||||
}
|
||||
|
||||
if (!enabled) {
|
||||
mixpanel.opt_out_tracking();
|
||||
sentry.disable();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user