diff --git a/CHANGELOG.md b/CHANGELOG.md index 4726d983..138f7167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.26.0] - 2024-08-28 + +### Added + +- Added ability to send `IPC` messages when the sync is ready. PR: [bfx-reports-framework#405](https://github.com/bitfinexcom/bfx-reports-framework/pull/405) +- Added ability to show native notifications in case another screen is displayed and the app window is not hidden with multiple workspaces mode in `Ubuntu`/`Mac`. PR: [bfx-report-electron#389](https://github.com/bitfinexcom/bfx-report-electron/pull/389) +- Added ability to show the native notification in the electron app in case the `sync` is being processed in the background with the hidden main window. There we check if the main window is invisible and show a notification otherwise don't. PR: [bfx-report-electron#390](https://github.com/bitfinexcom/bfx-report-electron/pull/390) + +### Changed + +- Enhanced and unified `Logins` and `Change Logs` reports column configuration getters and reduced redundant code. PR: [bfx-report-ui#840](https://github.com/bitfinexcom/bfx-report-ui/pull/840) +- Reworked and optimized the `TimeFrameSelector` component in a more performant way and reduced redundant code. PR: [bfx-report-ui#841](https://github.com/bitfinexcom/bfx-report-ui/pull/841) +- Reworked cell generation configurations more concisely and optimally for `Wallets`, `Weighted Averages` and `Concentration Risk` reports. PR: [bfx-report-ui#842](https://github.com/bitfinexcom/bfx-report-ui/pull/842) +- Reworked and optimized `LedgersCategorySelect` in a more concise and performant way. PR: [bfx-report-ui#843](https://github.com/bitfinexcom/bfx-report-ui/pull/843) +- Reworked and optimized `Movements`, `Trades`, `Orders` and `Positions` reports column configuration getters. Implemented unified `getFeeCell` and `getActionCell` helpers for better reusability. PR: [bfx-report-ui#844](https://github.com/bitfinexcom/bfx-report-ui/pull/844) +- Reworked `CandlesTimeframe` in a more performant way and improved props linting. PR: [bfx-report-ui#845](https://github.com/bitfinexcom/bfx-report-ui/pull/845) +- Enhanced and unified `Snapshots` sections column configuration getters and reduced redundant code. PR: [bfx-report-ui#846](https://github.com/bitfinexcom/bfx-report-ui/pull/846) +- Removed deprecated methods and fields without breaking the logic and UI functionality. PRs: [bfx-report#389](https://github.com/bitfinexcom/bfx-report/pull/389), [bfx-reports-framework#403](https://github.com/bitfinexcom/bfx-reports-framework/pull/403) +- Improved DB file cleanups for test coverage hooks. PRs: [bfx-report#390](https://github.com/bitfinexcom/bfx-report/pull/390), [bitfinexcom/lokue#3](https://github.com/bitfinexcom/lokue/pull/3) +- Removed unused public colls conf accessor endpoints to use the common `getAllPublicCollsConfs`/`editAllPublicCollsConfs` ones without breaking the logic and UI functionality. PR: [bfx-reports-framework#404](https://github.com/bitfinexcom/bfx-reports-framework/pull/404) +- Implemented a class for DB models to typify and unify model objects. PR: [bfx-reports-framework#406](https://github.com/bitfinexcom/bfx-reports-framework/pull/406) +- Proxied `ENet` error tester for import in electron env. PR: [bfx-reports-framework#407](https://github.com/bitfinexcom/bfx-reports-framework/pull/407) + +### Fixed + +- Extended network error processing. Related to these issues: [bfx-report-electron#396](https://github.com/bitfinexcom/bfx-report-electron/issues/396), [bfx-report-electron#274](https://github.com/bitfinexcom/bfx-report-electron/issues/274). PR: [bfx-report#392](https://github.com/bitfinexcom/bfx-report/pull/392) +- Improved the tax report ccy conversion by adding `6` retries with `10sec` delay for getting `pub-trades` if returns non-array. PR: [bfx-reports-framework#402](https://github.com/bitfinexcom/bfx-reports-framework/pull/402) +- Extended network error processing and prevented showing the error modal dialog. Related to these issues: [bfx-report-electron#396](https://github.com/bitfinexcom/bfx-report-electron/issues/396), [bfx-report-electron#274](https://github.com/bitfinexcom/bfx-report-electron/issues/274). PR: [bfx-report-electron#397](https://github.com/bitfinexcom/bfx-report-electron/pull/397) + ## [4.25.0] - 2024-07-31 ### Added diff --git a/README.md b/README.md index 19b70f6b..0eaa60b2 100644 --- a/README.md +++ b/README.md @@ -161,3 +161,14 @@ npm run launch -- -aop ``` > Also, we provide [GitHub Actioins workflows](https://docs.github.com/en/actions/using-workflows/about-workflows) configs for automated building and publishing of the Electron app artifacts using the above-described scripts `./scripts/launch.sh` and `./scripts/build-release.sh`, see the corresponding file `.github/workflows/build-electron-app.yml` + +## Locations of ElectronJS App files on different OSs + +- Logs: + - Ubuntu: `~/.config/Bitfinex Report/logs` + - Windows: `C:\Users\$username\AppData\Roaming\Bitfinex Report\logs` + - Mac: ElectronJS logs: `~/Library/Logs/Bitfinex Report` and app logs `~/Library/Application Support/Bitfinex Report/logs` +- DB files `db-sqlite_sync_m0.db`, `db-sqlite_sync_m0.db-shm` (optional), `db-sqlite_sync_m0.db-wal` (optional): + - Ubuntu: `~/.config/Bitfinex Report` + - Windows: `C:\Users\$username\AppData\Roaming\Bitfinex Report` + - Mac: `~/Library/Application Support/Bitfinex Report` diff --git a/bfx-report-ui b/bfx-report-ui index ef3faa57..fe31d525 160000 --- a/bfx-report-ui +++ b/bfx-report-ui @@ -1 +1 @@ -Subproject commit ef3faa57d8919ca6833f85736a8911583d58a2b9 +Subproject commit fe31d52501fb436660120f738ddba00cded1de0a diff --git a/bfx-reports-framework b/bfx-reports-framework index 914ed9e5..60e9584e 160000 --- a/bfx-reports-framework +++ b/bfx-reports-framework @@ -1 +1 @@ -Subproject commit 914ed9e58fc9f526c6066d0c1f6e20c8c9c63faf +Subproject commit 60e9584eafc669e4f5d27265e67d3f135a0551d1 diff --git a/package.json b/package.json index 4eff9d76..d19468eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-report-electron", - "version": "4.25.0", + "version": "4.26.0", "repository": "https://github.com/bitfinexcom/bfx-report-electron", "description": "Reporting tool", "author": "bitfinex.com", diff --git a/server.js b/server.js index 2239b520..7e45a92f 100644 --- a/server.js +++ b/server.js @@ -61,6 +61,9 @@ const allowedProcessMessagesSet = _getAllowedStatesSet({ 'READY_TRX_TAX_REPORT', 'ERROR_TRX_TAX_REPORT', + 'READY_SYNC', + 'ERROR_SYNC', + 'ALL_TABLE_HAVE_BEEN_CLEARED', 'ALL_TABLE_HAVE_NOT_BEEN_CLEARED', diff --git a/src/error-manager/index.js b/src/error-manager/index.js index 976dc411..910e2fec 100644 --- a/src/error-manager/index.js +++ b/src/error-manager/index.js @@ -6,6 +6,10 @@ const cleanStack = require('clean-stack') const isDevEnv = process.env.NODE_ENV === 'development' +const { isENetError } = require( + '../../bfx-reports-framework/workers/loc.api/helpers/api-errors-testers' +) + const log = require('./log') const getErrorDescription = require('./get-error-description') const showModalDialog = require('./show-modal-dialog') @@ -216,8 +220,8 @@ const initLogger = () => { * - GitHub server can't respond to the auto-update requests */ if ( + isENetError(error) || /Cannot download differentially/gi.test(error) || - /ERR_CONNECTION_REFUSED/gi.test(error) || /objects\.githubusercontent\.com/gi.test(error) || /Error: ERR_FAILED \(-2\) loading 'file:.*\.html'/gi.test(error) || /Failed to generate PDF/gi.test(error) diff --git a/src/helpers/manage-window.js b/src/helpers/manage-window.js index 9bb72617..5f74f54d 100644 --- a/src/helpers/manage-window.js +++ b/src/helpers/manage-window.js @@ -111,8 +111,16 @@ const centerWindow = (win, workArea) => { win.setBounds(boundsOpts) } +const isWindowInvisible = (win) => { + return ( + !win?.isVisible() || + !win?.isFocused() + ) +} + module.exports = { hideWindow, showWindow, - centerWindow + centerWindow, + isWindowInvisible } diff --git a/src/manage-worker-messages.js b/src/manage-worker-messages.js index d269fb94..2cbd7265 100644 --- a/src/manage-worker-messages.js +++ b/src/manage-worker-messages.js @@ -10,8 +10,15 @@ const showMessageModalDialog = require( const isMainWinAvailable = require( './helpers/is-main-win-available' ) -const { showWindow } = require('./helpers/manage-window') -const showNotification = require('./show-notification') +const { + showWindow +} = require('./helpers/manage-window') +const showTrxTaxReportNotification = require( + './show-notification/show-trx-tax-report-notification' +) +const showSyncNotification = require( + './show-notification/show-sync-notification' +) const PROCESS_MESSAGES = require( '../bfx-reports-framework/workers/loc.api/process.message.manager/process.messages' ) @@ -238,19 +245,16 @@ module.exports = (ipc) => { ipc.send({ state: PROCESS_STATES.REMOVE_ALL_TABLES }) } if ( - ( - state === PROCESS_MESSAGES.READY_TRX_TAX_REPORT || - state === PROCESS_MESSAGES.ERROR_TRX_TAX_REPORT - ) && - !wins?.mainWindow?.isVisible() + state === PROCESS_MESSAGES.READY_TRX_TAX_REPORT || + state === PROCESS_MESSAGES.ERROR_TRX_TAX_REPORT ) { - const isError = state === PROCESS_MESSAGES.ERROR_TRX_TAX_REPORT - const body = isError - ? 'An unexpected error occurred while generating the tax report!' - : 'Your tax report is ready!' - const urgency = isError ? 'critical' : 'normal' - - showNotification({ body, urgency }) + showTrxTaxReportNotification(mess) + } + if ( + state === PROCESS_MESSAGES.READY_SYNC || + state === PROCESS_MESSAGES.ERROR_SYNC + ) { + showSyncNotification(mess) } } catch (err) { console.error(err) diff --git a/src/show-notification/show-sync-notification.js b/src/show-notification/show-sync-notification.js new file mode 100644 index 00000000..b63099a4 --- /dev/null +++ b/src/show-notification/show-sync-notification.js @@ -0,0 +1,43 @@ +'use strict' + +const PROCESS_MESSAGES = require( + '../../bfx-reports-framework/workers/loc.api/process.message.manager/process.messages' +) +const wins = require('../windows') +const { isWindowInvisible } = require('../helpers/manage-window') +const showNotification = require('./') + +const getBody = (params) => { + const { + isError, + isInterrupted + } = params ?? {} + + if (isError) { + return 'Data sync completed with an error!' + } + if (isInterrupted) { + return 'Data sync interrupted!' + } + + return 'Data sync completed successfully!' +} + +module.exports = (mess) => { + const { + state = '', + data = {} + } = mess ?? {} + + if (!isWindowInvisible(wins?.mainWindow)) { + return + } + + const isError = state === PROCESS_MESSAGES.ERROR_SYNC + const isInterrupted = !!data?.isInterrupted + + const body = getBody({ isError, isInterrupted }) + const urgency = isError ? 'critical' : 'normal' + + showNotification({ body, urgency }) +} diff --git a/src/show-notification/show-trx-tax-report-notification.js b/src/show-notification/show-trx-tax-report-notification.js new file mode 100644 index 00000000..02be5289 --- /dev/null +++ b/src/show-notification/show-trx-tax-report-notification.js @@ -0,0 +1,26 @@ +'use strict' + +const PROCESS_MESSAGES = require( + '../../bfx-reports-framework/workers/loc.api/process.message.manager/process.messages' +) +const wins = require('../windows') +const { isWindowInvisible } = require('../helpers/manage-window') +const showNotification = require('./') + +module.exports = (mess) => { + const { + state = '' + } = mess ?? {} + + if (!isWindowInvisible(wins?.mainWindow)) { + return + } + + const isError = state === PROCESS_MESSAGES.ERROR_TRX_TAX_REPORT + const body = isError + ? 'An unexpected error occurred while generating the tax report!' + : 'Your tax report is ready!' + const urgency = isError ? 'critical' : 'normal' + + showNotification({ body, urgency }) +}