diff --git a/CHANGELOG.md b/CHANGELOG.md index d03d2093..09ef2ab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,27 +2,24 @@ ## [1.3.0](https://github.com/zidoro/pomatez/compare/v1.2.3...v1.3.0) (2023-09-26) - ### Features ✨ -* add support for open at login in the settings tab ([f57e133](https://github.com/zidoro/pomatez/commit/f57e1335d59938d95c6de4455b96aafcc8a878a2)) -* increase maximum focus time to 2 hours ([#383](https://github.com/zidoro/pomatez/issues/383)) ([3fc1493](https://github.com/zidoro/pomatez/commit/3fc14937ee4b08e74390fbd36eb115278f55f179)) - +- add support for open at login in the settings tab ([f57e133](https://github.com/zidoro/pomatez/commit/f57e1335d59938d95c6de4455b96aafcc8a878a2)) +- increase maximum focus time to 2 hours ([#383](https://github.com/zidoro/pomatez/issues/383)) ([3fc1493](https://github.com/zidoro/pomatez/commit/3fc14937ee4b08e74390fbd36eb115278f55f179)) ### Bug Fixes 🐛 -* compact mode layout broke with 120 minutes max timer config ([#393](https://github.com/zidoro/pomatez/issues/393)) ([c8c3c66](https://github.com/zidoro/pomatez/commit/c8c3c66460116aefe8a172b4237fa08b52583ffc)) -* disable dragging for navigation links ([#387](https://github.com/zidoro/pomatez/issues/387)) ([a5b147f](https://github.com/zidoro/pomatez/commit/a5b147fbac812b2be6e92ce218841bfebe29d790)) -* fix security issues ([bcbd65f](https://github.com/zidoro/pomatez/commit/bcbd65fa18d5f5531b20ab2ee0462b03ec766b5c)), closes [#407](https://github.com/zidoro/pomatez/issues/407) -* notification type selection issue in settings ([04ddca1](https://github.com/zidoro/pomatez/commit/04ddca16023bfea1b6496d41769ee7715700354d)) +- compact mode layout broke with 120 minutes max timer config ([#393](https://github.com/zidoro/pomatez/issues/393)) ([c8c3c66](https://github.com/zidoro/pomatez/commit/c8c3c66460116aefe8a172b4237fa08b52583ffc)) +- disable dragging for navigation links ([#387](https://github.com/zidoro/pomatez/issues/387)) ([a5b147f](https://github.com/zidoro/pomatez/commit/a5b147fbac812b2be6e92ce218841bfebe29d790)) +- fix security issues ([bcbd65f](https://github.com/zidoro/pomatez/commit/bcbd65fa18d5f5531b20ab2ee0462b03ec766b5c)), closes [#407](https://github.com/zidoro/pomatez/issues/407) +- notification type selection issue in settings ([04ddca1](https://github.com/zidoro/pomatez/commit/04ddca16023bfea1b6496d41769ee7715700354d)) ## [1.2.3](https://github.com/zidoro/pomatez/compare/v1.2.2...v1.2.3) (2023-05-03) - ### Bug Fixes 🐛 -* **app/renderer:** fix linter warnings that causes CI test build failing ([26edd59](https://github.com/zidoro/pomatez/commit/26edd59b26155954208fafc0dc3d933501c11bc9)) -* Set Application Menu to Fix Mac Shortcuts ([0e6d47f](https://github.com/zidoro/pomatez/commit/0e6d47f0eb166256f914494518b4ea9e63160c06)) +- **app/renderer:** fix linter warnings that causes CI test build failing ([26edd59](https://github.com/zidoro/pomatez/commit/26edd59b26155954208fafc0dc3d933501c11bc9)) +- Set Application Menu to Fix Mac Shortcuts ([0e6d47f](https://github.com/zidoro/pomatez/commit/0e6d47f0eb166256f914494518b4ea9e63160c06)) ## [1.2.2](https://github.com/zidoro/pomatez/compare/v1.2.1...v1.2.2) (2022-12-21) diff --git a/app/main/package.json b/app/main/package.json index 83fa3895..558b8576 100644 --- a/app/main/package.json +++ b/app/main/package.json @@ -14,7 +14,7 @@ "scripts": { "prepare": "yarn build", "clean": "rimraf dist/ build/", - "predev:main": "wait-on http://localhost:3000", + "predev:main": "wait-on http://127.0.0.1:3000", "dev:main": "nodemon --exec \"yarn build && electron .\"", "start": "yarn dev:main", "build": "tsc && copyfiles -u 2 \"src/assets/*\" build/assets", diff --git a/app/main/src/helpers/analytics.ts b/app/main/src/helpers/analytics.ts index 992fc1ae..e9e3bb9d 100644 --- a/app/main/src/helpers/analytics.ts +++ b/app/main/src/helpers/analytics.ts @@ -3,9 +3,9 @@ import { v4 as uuid } from "uuid"; import store from "../store"; -const userId = store.get("userId") || uuid(); +const userId = store.safeGet("userId") || uuid(); -store.set("userId", userId); +store.safeSet("userId", userId); function activateUser() { const user = ua("UA-172128342-2", userId); diff --git a/app/main/src/main.ts b/app/main/src/main.ts index d3329a29..2f3f51c9 100644 --- a/app/main/src/main.ts +++ b/app/main/src/main.ts @@ -66,7 +66,7 @@ const getFrameHeight = () => { if (isWindow()) { return 502; } else { - if (store.get("useNativeTitlebar")) { + if (store.safeGet("useNativeTitlebar")) { return 488; } return 502; @@ -93,9 +93,9 @@ function createMainWindow() { resizable: true, maximizable: false, show: false, - frame: store.get("useNativeTitlebar"), + frame: store.safeGet("useNativeTitlebar"), icon: getIcon(), - backgroundColor: store.get("isDarkMode") ? "#141e25" : "#fff", + backgroundColor: store.safeGet("isDarkMode") ? "#141e25" : "#fff", webPreferences: { contextIsolation: true, backgroundThrottling: false, @@ -337,7 +337,9 @@ if (!onlySingleInstance) { actions: ["View Released Notes"], callback: (err, response) => { if (!err) { - shell.openExternal(RELEASED_NOTES_LINK); + if (response === "view released notes") { + shell.openExternal(RELEASED_NOTES_LINK); + } } }, }); @@ -391,7 +393,7 @@ ipcMain.on(SET_COMPACT_MODE, (e, args) => { }); ipcMain.on(SET_UI_THEME, (e, { isDarkMode }) => { - store.set("isDarkMode", isDarkMode); + store.safeSet("isDarkMode", isDarkMode); }); ipcMain.on(SET_SHOW, () => { @@ -425,8 +427,8 @@ ipcMain.on(SET_CLOSE, (e, { closeToTray }) => { }); ipcMain.on(SET_NATIVE_TITLEBAR, (e, { useNativeTitlebar }) => { - if (store.get("useNativeTitlebar") !== useNativeTitlebar) { - store.set("useNativeTitlebar", useNativeTitlebar); + if (store.safeGet("useNativeTitlebar") !== useNativeTitlebar) { + store.safeSet("useNativeTitlebar", useNativeTitlebar); setTimeout(() => { app.relaunch(); app.exit(); @@ -440,7 +442,7 @@ ipcMain.on(TRAY_ICON_UPDATE, (e, dataUrl) => { }); ipcMain.on(SET_OPEN_AT_LOGIN, (e, { openAtLogin }) => { - store.set("openAtLogin", openAtLogin); + store.safeSet("openAtLogin", openAtLogin); app.setLoginItemSettings({ openAtLogin: openAtLogin, openAsHidden: openAtLogin, diff --git a/app/main/src/store.ts b/app/main/src/store.ts index 365a1a0a..e5558246 100644 --- a/app/main/src/store.ts +++ b/app/main/src/store.ts @@ -1,6 +1,7 @@ -import Store from "electron-store"; +import Store, { Options } from "electron-store"; import { nativeTheme } from "electron"; import { isWindow } from "./helpers"; +import ElectronStore from "electron-store"; type StoreProps = { userId?: string; @@ -10,7 +11,48 @@ type StoreProps = { openAtLogin?: boolean; }; -const store = new Store({ +/** + * Was going to make SafeStore extend Store but it didn't seem to work how it should. (Class constructor ElectronStore cannot be invoked without 'new') + * + * This also ensures that we can force calling the store safely. Though I have switched the names to safeGet and safeSet to make it more clear. + */ +class SafeStore< + T extends Record = Record, +> { + private store: ElectronStore; + constructor(props: Options) { + this.store = new Store(props); + } + + /** + * Safely set a value in the store and catch errors + * @param key + * @param value + */ + safeSet(key: Key, value?: T[Key]) { + try { + this.store.set(key, value); + } catch (error) { + console.error("[Store] Safe Set", error); + } + } + + /** + * Safely get a value from the store and catch errors + * @param key + */ + safeGet(key: Key): T[Key] | undefined { + try { + return this.store.get(key); + } catch (error) { + console.error("[Store] Safe Get", error); + } + return undefined; + } +} + +// Wrap the store due to a delete issue +const store = new SafeStore({ defaults: { isDarkMode: nativeTheme.shouldUseDarkColors, useNativeTitlebar: !isWindow(), diff --git a/app/renderer/src/styles/routes/tasks/card.ts b/app/renderer/src/styles/routes/tasks/card.ts index a4097f1d..5d48579b 100644 --- a/app/renderer/src/styles/routes/tasks/card.ts +++ b/app/renderer/src/styles/routes/tasks/card.ts @@ -98,7 +98,9 @@ export const StyledCard = styled.div` border-bottom-color: var(--color-border-input-secondary); background-color: var(--color-bg-task-card); - transition: box-shadow 320ms ease-out, background-color 320ms ease-out, +:w transition: + box-shadow 320ms ease-out, + background-color 320ms ease-out, border-color 320ms ease-out; ${(p) =>