Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/2316 debug mode #135

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 11 additions & 8 deletions src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};

Expand Down Expand Up @@ -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());
Expand Down
10 changes: 0 additions & 10 deletions src/util/app-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
1 change: 0 additions & 1 deletion src/util/config-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const ConfigLoader = {

// Make api endpoint available through localstorage.
appStorage.setApiUrl(configData.apiEndpoint);
appStorage.setDebug(configData.debug ?? false);

resolve(configData);
})
Expand Down
1 change: 0 additions & 1 deletion src/util/local-storage-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const localStorageKeys = {
REFRESH_TOKEN: 'refreshToken',
FALLBACK_IMAGE: 'fallbackImage',
API_URL: 'apiUrl',
DEBUG: 'debug',
PREVIOUS_BOOT: 'previousBoot',
};

Expand Down
Loading