11'use strict'
22
33const { app } = require ( 'electron' )
4- const path = require ( 'path' )
54const i18next = require ( 'i18next' )
65
7- const isMac = process . platform === 'darwin'
8- const { REPORT_FILES_PATH_VERSION } = require ( './const' )
9-
106const TranslationIpcChannelHandlers = require (
117 './window-creators/main-renderer-ipc-bridge/translation-ipc-channel-handlers'
128)
@@ -37,17 +33,15 @@ const {
3733} = require ( './window-creators/change-loading-win-visibility-state' )
3834const WINDOW_NAMES = require ( './window-creators/window.names' )
3935const makeOrReadSecretKey = require ( './make-or-read-secret-key' )
40- const {
41- configsKeeperFactory
42- } = require ( './configs-keeper' )
4336const {
4437 IpcMessageError,
4538 AppInitializationError
4639} = require ( './errors' )
4740const {
4841 deserializeError,
4942 getFreePort,
50- initIpcChannelHandlers
43+ initIpcChannelHandlers,
44+ manageConfigs
5145} = require ( './helpers' )
5246const getUserDataPath = require ( './helpers/get-user-data-path' )
5347const {
@@ -61,28 +55,6 @@ const manageWorkerMessages = require(
6155)
6256const printToPDF = require ( './print-to-pdf' )
6357
64- const _resetReportFilesPath = async (
65- configsKeeper ,
66- opts = { }
67- ) => {
68- const {
69- pathToUserReportFiles
70- } = opts
71-
72- // Need to use a new report folder path for export
73- const reportFilesPathVersion = configsKeeper
74- . getConfigByName ( 'reportFilesPathVersion' )
75-
76- if ( reportFilesPathVersion === REPORT_FILES_PATH_VERSION ) {
77- return
78- }
79-
80- await configsKeeper . saveConfigs ( {
81- reportFilesPathVersion : REPORT_FILES_PATH_VERSION ,
82- pathToUserReportFiles
83- } )
84- }
85-
8658const _ipcMessToPromise = ( ipc ) => {
8759 return new Promise ( ( resolve , reject ) => {
8860 try {
@@ -131,34 +103,6 @@ const _ipcMessToPromise = (ipc) => {
131103 } )
132104}
133105
134- const _manageConfigs = ( params ) => {
135- const {
136- pathToUserData,
137- pathToUserDocuments,
138- pathToUserDownloads
139- } = params ?? { }
140-
141- const pathToUserReportFiles = isMac
142- ? pathToUserDownloads
143- : path . join (
144- pathToUserDocuments ,
145- 'bitfinex/reports'
146- )
147-
148- const configsKeeper = configsKeeperFactory (
149- {
150- pathToUserData,
151- configsByDefault : { pathToUserReportFiles }
152- }
153- )
154- _resetReportFilesPath (
155- configsKeeper ,
156- { pathToUserReportFiles }
157- )
158-
159- return configsKeeper
160- }
161-
162106module . exports = async ( ) => {
163107 try {
164108 initIpcChannelHandlers (
@@ -187,7 +131,7 @@ module.exports = async () => {
187131 const pathToUserDocuments = app . getPath ( 'documents' )
188132 const pathToUserDownloads = app . getPath ( 'downloads' )
189133
190- const configsKeeper = _manageConfigs ( {
134+ const configsKeeper = manageConfigs ( {
191135 pathToUserData,
192136 pathToUserDocuments,
193137 pathToUserDownloads
0 commit comments