mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 02:35:58 +08:00
chore(core): handle the telemetry warnings in console (#6793)
This commit is contained in:
@@ -15,6 +15,12 @@ export class TelemetryService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onApplicationStart() {
|
onApplicationStart() {
|
||||||
|
if (process.env.MIXPANEL_TOKEN) {
|
||||||
|
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
|
||||||
|
track_pageview: true,
|
||||||
|
persistence: 'localStorage',
|
||||||
|
});
|
||||||
|
}
|
||||||
const account = this.auth.session.account$.value;
|
const account = this.auth.session.account$.value;
|
||||||
if (account) {
|
if (account) {
|
||||||
mixpanel.identify(account.id);
|
mixpanel.identify(account.id);
|
||||||
|
|||||||
@@ -6,14 +6,8 @@ import { useLayoutEffect } from 'react';
|
|||||||
export function Telemetry() {
|
export function Telemetry() {
|
||||||
const settings = useAtomValue(appSettingAtom);
|
const settings = useAtomValue(appSettingAtom);
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (process.env.MIXPANEL_TOKEN) {
|
if (settings.enableTelemetry === false) {
|
||||||
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
|
mixpanel.opt_out_tracking();
|
||||||
track_pageview: true,
|
|
||||||
persistence: 'localStorage',
|
|
||||||
});
|
|
||||||
if (settings.enableTelemetry === false) {
|
|
||||||
mixpanel.opt_out_tracking();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [settings.enableTelemetry]);
|
}, [settings.enableTelemetry]);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import '@affine/core/bootstrap/preload';
|
|||||||
import { appConfigProxy } from '@affine/core/hooks/use-app-config-storage';
|
import { appConfigProxy } from '@affine/core/hooks/use-app-config-storage';
|
||||||
import { performanceLogger } from '@affine/core/shared';
|
import { performanceLogger } from '@affine/core/shared';
|
||||||
import { apis, events } from '@affine/electron-api';
|
import { apis, events } from '@affine/electron-api';
|
||||||
import { init, replayIntegration, setTags } from '@sentry/electron/renderer';
|
import { init, setTags } from '@sentry/electron/renderer';
|
||||||
import {
|
import {
|
||||||
init as reactInit,
|
init as reactInit,
|
||||||
reactRouterV6BrowserTracingIntegration,
|
reactRouterV6BrowserTracingIntegration,
|
||||||
@@ -50,7 +50,6 @@ function main() {
|
|||||||
createRoutesFromChildren,
|
createRoutesFromChildren,
|
||||||
matchRoutes,
|
matchRoutes,
|
||||||
}),
|
}),
|
||||||
replayIntegration(),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
reactInit
|
reactInit
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { isDesktop } from '@affine/env/constant';
|
|||||||
import {
|
import {
|
||||||
init,
|
init,
|
||||||
reactRouterV6BrowserTracingIntegration,
|
reactRouterV6BrowserTracingIntegration,
|
||||||
replayIntegration,
|
|
||||||
setTags,
|
setTags,
|
||||||
} from '@sentry/react';
|
} from '@sentry/react';
|
||||||
import { StrictMode, useEffect } from 'react';
|
import { StrictMode, useEffect } from 'react';
|
||||||
@@ -44,7 +43,6 @@ function main() {
|
|||||||
createRoutesFromChildren,
|
createRoutesFromChildren,
|
||||||
matchRoutes,
|
matchRoutes,
|
||||||
}),
|
}),
|
||||||
replayIntegration(),
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
setTags({
|
setTags({
|
||||||
|
|||||||
Reference in New Issue
Block a user