Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 59bb157

Browse files
authored
Merge pull request #10 from Yadro/fixes
Hide vars, optimize getting path
2 parents 716af5c + 3c82473 commit 59bb157

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/base/repositories/AbstractFileRepository.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const APP_DIR =
1212
? 'YadroTimeTracker_test'
1313
: 'YadroTimeTracker';
1414

15+
let _appDataPath: string = '';
16+
1517
export default abstract class AbstractFileRepository<T = any> {
1618
dirWithProfileData: string = 'profile1';
1719
fileName: string = 'defaultFileName.json';
@@ -25,7 +27,11 @@ export default abstract class AbstractFileRepository<T = any> {
2527
}
2628

2729
static get appDataFolder() {
28-
return ipcRenderer.sendSync(EChannels.GetPathUserData);
30+
if (_appDataPath) {
31+
return _appDataPath;
32+
}
33+
_appDataPath = ipcRenderer.sendSync(EChannels.GetPathUserData);
34+
return _appDataPath;
2935
}
3036

3137
private get destFolder() {

src/components/SettingsModal/SettingsModal.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,14 @@ const SettingsModal: React.VFC<ISettingsModalProps> = observer(
131131
Test Sentry
132132
</Button>
133133
)}
134-
<p>{`APPDATA: ${AbstractFileRepository.appDataFolder}`}</p>
135-
<p>{`SENTRY_DSN: ${process.env.SENTRY_DSN}`}</p>
136-
<p>{`GA_UACODE: ${process.env.GA_UACODE}`}</p>
134+
{(process.env.NODE_ENV === 'development' ||
135+
process.env.DEBUG_PROD === 'true') && (
136+
<>
137+
<p>{`APPDATA: ${AbstractFileRepository.appDataFolder}`}</p>
138+
<p>{`SENTRY_DSN: ${process.env.SENTRY_DSN}`}</p>
139+
<p>{`GA_UACODE: ${process.env.GA_UACODE}`}</p>
140+
</>
141+
)}
137142
</Modal>
138143
);
139144
}

0 commit comments

Comments
 (0)