Skip to content

Commit

Permalink
fix: stabilize timer
Browse files Browse the repository at this point in the history
  • Loading branch information
evereq committed Mar 30, 2024
1 parent 345a450 commit 44924b8
Show file tree
Hide file tree
Showing 8 changed files with 462 additions and 426 deletions.
26 changes: 24 additions & 2 deletions apps/desktop-timer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,18 +591,24 @@ ipcMain.handle('PREFERRED_LANGUAGE', (event, arg) => {
});

app.on('before-quit', async (e) => {
console.log('App is quitting');
e.preventDefault();

const appSetting = LocalStore.getStore('appSetting');

if (appSetting && appSetting.timerStarted) {
e.preventDefault();

const exitConfirmationDialog = new DialogStopTimerExitConfirmation(
new DesktopDialog(
process.env.DESCRIPTION,
TranslateService.instant('TIMER_TRACKER.DIALOG.EXIT'),
timeTrackerWindow
)
);

const button = await exitConfirmationDialog.show();

if (button.response === 0) {
willQuit = true;
timeTrackerWindow.webContents.send('stop_from_tray', {
Expand All @@ -614,11 +620,27 @@ app.on('before-quit', async (e) => {
try {
updater.cancel();
} catch (e) {
console.error('ERROR: Occurred while cancel update:' + e);
throw new AppError('MAINUPDTABORT', e);
}

if (serverDesktop) {
try {
serverDesktop.kill();
} catch (error) {
console.error('ERROR: Occurred while serverDesktop stop:' + error);
}
}

if (serverGauzy) {
try {
serverGauzy.kill();
} catch (error) {
console.error('ERROR: Occurred while serverGauzy stop:' + error);
}
}

app.exit(0);
if (serverDesktop) serverDesktop.kill();
if (serverGauzy) serverGauzy.kill();
}
});

Expand Down
340 changes: 170 additions & 170 deletions apps/desktop-timer/src/package.json
Original file line number Diff line number Diff line change
@@ -1,171 +1,171 @@
{
"name": "gauzy-desktop-timer",
"productName": "Gauzy Desktop Timer",
"version": "0.1.0",
"description": "Gauzy Desktop Timer",
"license": "AGPL-3.0",
"homepage": "https://gauzy.co",
"repository": {
"type": "git",
"url": "https://github.com/ever-co/ever-gauzy.git"
},
"bugs": {
"url": "https://github.com/ever-co/ever-gauzy/issues"
},
"private": true,
"author": {
"name": "Ever Co. LTD",
"email": "ever@ever.co",
"url": "https://ever.co"
},
"main": "index.js",
"workspaces": {
"packages": [
"../../../packages/contracts",
"../../../packages/desktop-window",
"../../../packages/desktop-libs"
]
},
"build": {
"appId": "com.ever.gauzydesktoptimer",
"artifactName": "${name}-${version}.${ext}",
"productName": "Gauzy Desktop Timer",
"copyright": "Copyright © 2019-Present. Ever Co. LTD",
"afterSign": "tools/notarize.js",
"dmg": {
"sign": false
},
"asar": true,
"npmRebuild": true,
"asarUnpack": [
"node_modules/screenshot-desktop/lib/win32",
"node_modules/@sentry/electron",
"node_modules/sqlite3/lib",
"node_modules/better-sqlite3",
"node_modules/@sentry/profiling-node/lib"
],
"directories": {
"buildResources": "icons",
"output": "../desktop-timer-packages"
},
"publish": [
{
"provider": "github",
"repo": "ever-gauzy-desktop-timer",
"releaseType": "release"
},
{
"provider": "spaces",
"name": "ever",
"region": "sfo3",
"path": "/ever-gauzy-desktop-timer",
"acl": "public-read"
}
],
"mac": {
"category": "public.app-category.developer-tools",
"icon": "icon.icns",
"target": [
"zip",
"dmg"
],
"asarUnpack": "**/*.node",
"artifactName": "${name}-${version}.${ext}",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "tools/build/entitlements.mas.plist",
"entitlementsInherit": "tools/build/entitlements.mas.plist",
"extendInfo": {
"NSAppleEventsUsageDescription": "Please allow access to script browser applications to detect the current URL when triggering instant lookup.",
"NSCameraUsageDescription": "Please allow access to Gauzy Desktop Timer to make screenshot"
}
},
"win": {
"publisherName": "Ever",
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"icon": "icon.ico",
"verifyUpdateCodeSignature": false
},
"linux": {
"icon": "linux",
"target": [
"AppImage",
"deb",
"tar.gz"
],
"executableName": "gauzy-desktop-timer",
"artifactName": "${name}-${version}.${ext}",
"synopsis": "Desktop",
"category": "Development"
},
"nsis": {
"oneClick": false,
"perMachine": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"allowToChangeInstallationDirectory": true,
"allowElevation": true,
"installerIcon": "icon.ico",
"artifactName": "${name}-${version}.${ext}",
"deleteAppDataOnUninstall": true,
"menuCategory": true
},
"extraResources": [
"./data/**/*",
"databaseDir",
{
"from": "assets",
"to": "assets"
}
],
"extraFiles": [
"./**/desktop-libs/**/migrations/*"
]
},
"dependencies": {
"@datorama/akita": "^7.1.1",
"@datorama/akita-ngdevtools": "^7.0.0",
"@electron/remote": "^2.0.8",
"@gauzy/contracts": "^0.1.0",
"@gauzy/desktop-libs": "^0.1.0",
"@gauzy/desktop-window": "^0.1.0",
"@sentry/electron": "^4.18.0",
"@sentry/profiling-node": "^7.101.1",
"@sentry/replay": "^7.101.1",
"@sentry/node": "^7.101.1",
"@sentry/tracing": "^7.101.1",
"@sentry/types": "^7.101.1",
"auto-launch": "5.0.5",
"consolidate": "^0.16.0",
"electron-log": "^4.4.8",
"electron-store": "^8.1.0",
"electron-updater": "^6.1.7",
"electron-util": "^0.17.2",
"embedded-queue": "^0.0.11",
"ffi-napi": "^4.0.3",
"form-data": "^3.0.0",
"htmlparser2": "^8.0.2",
"iconv": "^3.0.1",
"knex": "^3.1.0",
"mac-screen-capture-permissions": "^2.0.0",
"moment": "^2.29.4",
"node-fetch": "^2.6.7",
"node-notifier": "^8.0.0",
"pg": "^8.11.3",
"pg-query-stream": "^4.5.3",
"screenshot-desktop": "^1.12.7",
"sound-play": "1.1.0",
"sqlite3": "^5.1.7",
"squirrelly": "^8.0.8",
"tslib": "^2.3.0",
"twing": "^5.0.2",
"underscore": "^1.13.3"
}
}
"name": "gauzy-desktop-timer",
"productName": "Gauzy Desktop Timer",
"version": "0.1.0",
"description": "Gauzy Desktop Timer",
"license": "AGPL-3.0",
"homepage": "https://gauzy.co",
"repository": {
"type": "git",
"url": "https://github.com/ever-co/ever-gauzy.git"
},
"bugs": {
"url": "https://github.com/ever-co/ever-gauzy/issues"
},
"private": true,
"author": {
"name": "Ever Co. LTD",
"email": "ever@ever.co",
"url": "https://ever.co"
},
"main": "index.js",
"workspaces": {
"packages": [
"../../../packages/contracts",
"../../../packages/desktop-window",
"../../../packages/desktop-libs"
]
},
"build": {
"appId": "com.ever.gauzydesktoptimer",
"artifactName": "${name}-${version}.${ext}",
"productName": "Gauzy Desktop Timer",
"copyright": "Copyright © 2019-Present. Ever Co. LTD",
"afterSign": "tools/notarize.js",
"dmg": {
"sign": false
},
"asar": true,
"npmRebuild": true,
"asarUnpack": [
"node_modules/screenshot-desktop/lib/win32",
"node_modules/@sentry/electron",
"node_modules/sqlite3/lib",
"node_modules/better-sqlite3",
"node_modules/@sentry/profiling-node/lib"
],
"directories": {
"buildResources": "icons",
"output": "../desktop-timer-packages"
},
"publish": [
{
"provider": "github",
"repo": "ever-gauzy-desktop-timer",
"releaseType": "release"
},
{
"provider": "spaces",
"name": "ever",
"region": "sfo3",
"path": "/ever-gauzy-desktop-timer",
"acl": "public-read"
}
],
"mac": {
"category": "public.app-category.developer-tools",
"icon": "icon.icns",
"target": [
"zip",
"dmg"
],
"asarUnpack": "**/*.node",
"artifactName": "${name}-${version}.${ext}",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "tools/build/entitlements.mas.plist",
"entitlementsInherit": "tools/build/entitlements.mas.plist",
"extendInfo": {
"NSAppleEventsUsageDescription": "Please allow access to script browser applications to detect the current URL when triggering instant lookup.",
"NSCameraUsageDescription": "Please allow access to Gauzy Desktop Timer to make screenshot"
}
},
"win": {
"publisherName": "Ever",
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"icon": "icon.ico",
"verifyUpdateCodeSignature": false
},
"linux": {
"icon": "linux",
"target": [
"AppImage",
"deb",
"tar.gz"
],
"executableName": "gauzy-desktop-timer",
"artifactName": "${name}-${version}.${ext}",
"synopsis": "Desktop",
"category": "Development"
},
"nsis": {
"oneClick": false,
"perMachine": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"allowToChangeInstallationDirectory": true,
"allowElevation": true,
"installerIcon": "icon.ico",
"artifactName": "${name}-${version}.${ext}",
"deleteAppDataOnUninstall": true,
"menuCategory": true
},
"extraResources": [
"./data/**/*",
"databaseDir",
{
"from": "assets",
"to": "assets"
}
],
"extraFiles": [
"./**/desktop-libs/**/migrations/*"
]
},
"dependencies": {
"@datorama/akita": "^7.1.1",
"@datorama/akita-ngdevtools": "^7.0.0",
"@electron/remote": "^2.0.8",
"@gauzy/contracts": "^0.1.0",
"@gauzy/desktop-libs": "^0.1.0",
"@gauzy/desktop-window": "^0.1.0",
"@sentry/electron": "^4.18.0",
"@sentry/profiling-node": "^7.101.1",
"@sentry/replay": "^7.101.1",
"@sentry/node": "^7.101.1",
"@sentry/tracing": "^7.101.1",
"@sentry/types": "^7.101.1",
"auto-launch": "5.0.5",
"consolidate": "^0.16.0",
"electron-log": "^4.4.8",
"electron-store": "^8.1.0",
"electron-updater": "^6.1.7",
"electron-util": "^0.17.2",
"embedded-queue": "^0.0.11",
"ffi-napi": "^4.0.3",
"form-data": "^3.0.0",
"htmlparser2": "^8.0.2",
"iconv": "^3.0.1",
"knex": "^3.1.0",
"mac-screen-capture-permissions": "^2.0.0",
"moment": "^2.29.4",
"node-fetch": "^2.6.7",
"node-notifier": "^8.0.0",
"pg": "^8.11.3",
"pg-query-stream": "^4.5.3",
"screenshot-desktop": "^1.12.7",
"sound-play": "1.1.0",
"sqlite3": "^5.1.7",
"squirrelly": "^8.0.8",
"tslib": "^2.3.0",
"twing": "^5.0.2",
"underscore": "^1.13.3"
}
}
Loading

0 comments on commit 44924b8

Please sign in to comment.