mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-01 20:03:30 +02:00
Add PostHog analytics to desktop main process
This commit is contained in:
parent
e85c355592
commit
8566b03c91
7 changed files with 75 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ import { registerAutocomplete, unregisterAutocomplete } from './modules/autocomp
|
|||
import { registerFolderWatcher, unregisterFolderWatcher } from './modules/folder-watcher';
|
||||
import { registerIpcHandlers } from './ipc/handlers';
|
||||
import { createTray, destroyTray } from './modules/tray';
|
||||
import { initAnalytics, shutdownAnalytics, trackEvent } from './modules/analytics';
|
||||
|
||||
registerGlobalErrorHandlers();
|
||||
|
||||
|
|
@ -22,6 +23,8 @@ if (!setupDeepLinks()) {
|
|||
registerIpcHandlers();
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
initAnalytics();
|
||||
trackEvent('desktop_app_launched');
|
||||
setupMenu();
|
||||
try {
|
||||
await startNextServer();
|
||||
|
|
@ -70,9 +73,15 @@ app.on('before-quit', () => {
|
|||
isQuitting = true;
|
||||
});
|
||||
|
||||
app.on('will-quit', () => {
|
||||
let didCleanup = false;
|
||||
app.on('will-quit', async (e) => {
|
||||
if (didCleanup) return;
|
||||
didCleanup = true;
|
||||
e.preventDefault();
|
||||
unregisterQuickAsk();
|
||||
unregisterAutocomplete();
|
||||
unregisterFolderWatcher();
|
||||
destroyTray();
|
||||
await shutdownAnalytics();
|
||||
app.exit();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue