diff --git a/CHANGELOG.md b/CHANGELOG.md index ef40f5c8..656cd602 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. ## Unreleased +- [#135](https://github.com/os2display/display-client/pull/135) + - Fixed cursor being hidden when not in debug mode. + - Moved registration of listeners in useEffect. - [#134](https://github.com/os2display/display-client/pull/134) - Fixed remote loader for touch regions. - [#133](https://github.com/os2display/display-client/pull/133) diff --git a/src/app.jsx b/src/app.jsx index e6ad0d7d..b0923e2d 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -24,12 +24,11 @@ function App() { const [screen, setScreen] = useState(""); const [bindKey, setBindKey] = useState(null); const [displayFallback, setDisplayFallback] = useState(true); + const [debug, setDebug] = useState(false); const checkLoginTimeoutRef = useRef(null); const contentServiceRef = useRef(null); - const debug = appStorage.getDebug(); - const fallbackImageUrl = appStorage.getFallbackImageUrl(); const fallbackStyle = {}; @@ -189,18 +188,22 @@ function App() { useEffect(() => { logger.info("Mounting App."); + document.addEventListener("keypress", handleKeyboard); + document.addEventListener("screen", screenHandler); + document.addEventListener("reauthenticate", reauthenticateHandler); + document.addEventListener("contentEmpty", contentEmpty); + document.addEventListener("contentNotEmpty", contentNotEmpty); + tokenService.checkToken(); + ConfigLoader.loadConfig().then((config) => { + setDebug(config.debug ?? false); + }); + releaseService.checkForNewRelease().finally(() => { releaseService.setPreviousBootInUrl(); releaseService.startReleaseCheck(); - document.addEventListener("screen", screenHandler); - document.addEventListener("reauthenticate", reauthenticateHandler); - document.addEventListener("contentEmpty", contentEmpty); - document.addEventListener("contentNotEmpty", contentNotEmpty); - document.addEventListener("keypress", handleKeyboard); - checkLogin(); appStorage.setPreviousBoot(new Date().getTime()); diff --git a/src/util/app-storage.js b/src/util/app-storage.js index 1da01e04..97d599a3 100644 --- a/src/util/app-storage.js +++ b/src/util/app-storage.js @@ -114,16 +114,6 @@ class AppStorage { localStorage.setItem(localStorageKeys.API_URL, apiUrl); }; - // Debug - - getDebug = () => { - return localStorage.getItem(localStorageKeys.DEBUG); - }; - - setDebug = (debug) => { - localStorage.setItem(localStorageKeys.DEBUG, debug); - }; - // pBoot - previous boot timestamp getPreviousBoot = () => { diff --git a/src/util/config-loader.js b/src/util/config-loader.js index c700990b..f51213ea 100644 --- a/src/util/config-loader.js +++ b/src/util/config-loader.js @@ -35,7 +35,6 @@ const ConfigLoader = { // Make api endpoint available through localstorage. appStorage.setApiUrl(configData.apiEndpoint); - appStorage.setDebug(configData.debug ?? false); resolve(configData); }) diff --git a/src/util/local-storage-keys.js b/src/util/local-storage-keys.js index d74fdd8f..61ba7117 100644 --- a/src/util/local-storage-keys.js +++ b/src/util/local-storage-keys.js @@ -8,7 +8,6 @@ const localStorageKeys = { REFRESH_TOKEN: 'refreshToken', FALLBACK_IMAGE: 'fallbackImage', API_URL: 'apiUrl', - DEBUG: 'debug', PREVIOUS_BOOT: 'previousBoot', };