Skip to content

Commit 9dfe4a2

Browse files
authored
Merge pull request #135 from os2display/feature/2316-debug-mode
Feature/2316 debug mode
2 parents 09eb894 + 94b2fe8 commit 9dfe4a2

File tree

5 files changed

+14
-20
lines changed

5 files changed

+14
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased
66

7+
- [#135](https://github.com/os2display/display-client/pull/135)
8+
- Fixed cursor being hidden when not in debug mode.
9+
- Moved registration of listeners in useEffect.
710
- [#134](https://github.com/os2display/display-client/pull/134)
811
- Fixed remote loader for touch regions.
912
- [#133](https://github.com/os2display/display-client/pull/133)

src/app.jsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ function App() {
2424
const [screen, setScreen] = useState("");
2525
const [bindKey, setBindKey] = useState(null);
2626
const [displayFallback, setDisplayFallback] = useState(true);
27+
const [debug, setDebug] = useState(false);
2728

2829
const checkLoginTimeoutRef = useRef(null);
2930
const contentServiceRef = useRef(null);
3031

31-
const debug = appStorage.getDebug();
32-
3332
const fallbackImageUrl = appStorage.getFallbackImageUrl();
3433
const fallbackStyle = {};
3534

@@ -189,18 +188,22 @@ function App() {
189188
useEffect(() => {
190189
logger.info("Mounting App.");
191190

191+
document.addEventListener("keypress", handleKeyboard);
192+
document.addEventListener("screen", screenHandler);
193+
document.addEventListener("reauthenticate", reauthenticateHandler);
194+
document.addEventListener("contentEmpty", contentEmpty);
195+
document.addEventListener("contentNotEmpty", contentNotEmpty);
196+
192197
tokenService.checkToken();
193198

199+
ConfigLoader.loadConfig().then((config) => {
200+
setDebug(config.debug ?? false);
201+
});
202+
194203
releaseService.checkForNewRelease().finally(() => {
195204
releaseService.setPreviousBootInUrl();
196205
releaseService.startReleaseCheck();
197206

198-
document.addEventListener("screen", screenHandler);
199-
document.addEventListener("reauthenticate", reauthenticateHandler);
200-
document.addEventListener("contentEmpty", contentEmpty);
201-
document.addEventListener("contentNotEmpty", contentNotEmpty);
202-
document.addEventListener("keypress", handleKeyboard);
203-
204207
checkLogin();
205208

206209
appStorage.setPreviousBoot(new Date().getTime());

src/util/app-storage.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,6 @@ class AppStorage {
114114
localStorage.setItem(localStorageKeys.API_URL, apiUrl);
115115
};
116116

117-
// Debug
118-
119-
getDebug = () => {
120-
return localStorage.getItem(localStorageKeys.DEBUG);
121-
};
122-
123-
setDebug = (debug) => {
124-
localStorage.setItem(localStorageKeys.DEBUG, debug);
125-
};
126-
127117
// pBoot - previous boot timestamp
128118

129119
getPreviousBoot = () => {

src/util/config-loader.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const ConfigLoader = {
3535

3636
// Make api endpoint available through localstorage.
3737
appStorage.setApiUrl(configData.apiEndpoint);
38-
appStorage.setDebug(configData.debug ?? false);
3938

4039
resolve(configData);
4140
})

src/util/local-storage-keys.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const localStorageKeys = {
88
REFRESH_TOKEN: 'refreshToken',
99
FALLBACK_IMAGE: 'fallbackImage',
1010
API_URL: 'apiUrl',
11-
DEBUG: 'debug',
1211
PREVIOUS_BOOT: 'previousBoot',
1312
};
1413

0 commit comments

Comments
 (0)