Screen Wake Lock
This commit is contained in:
11
js/app.js
11
js/app.js
@@ -4,8 +4,6 @@ import * as state from './core/state.js';
|
||||
import * as ui from './ui/ui.js';
|
||||
import * as timer from './core/timer.js';
|
||||
import camera from './ui/camera.js'; // Default export
|
||||
import audioManager from './ui/audio.js';
|
||||
import * as pushFlic from './services/pushFlicIntegration.js';
|
||||
import { initEnv } from './env-loader.js';
|
||||
import * as pushSettingsUI from './ui/pushSettingsUI.js'; // Import the new push settings UI module
|
||||
|
||||
@@ -14,6 +12,7 @@ import * as gameActions from './core/gameActions.js';
|
||||
import * as playerManager from './core/playerManager.js';
|
||||
import * as eventHandlers from './core/eventHandlers.js';
|
||||
import * as serviceWorkerManager from './services/serviceWorkerManager.js';
|
||||
import * as screenLockManager from './services/screenLockManager.js'; // Import the screen lock manager
|
||||
|
||||
// --- Initialization ---
|
||||
|
||||
@@ -93,12 +92,16 @@ async function initialize() {
|
||||
|
||||
// 7. Setup Service Worker (which also initializes Flic)
|
||||
serviceWorkerManager.setupServiceWorker(serviceWorkerManager.flicMessageHandler);
|
||||
|
||||
// 8. Initialize Screen Lock Manager (automatically acquires wake lock)
|
||||
const screenLockSupported = await screenLockManager.initScreenLockManager();
|
||||
console.log(`Screen Wake Lock API ${screenLockSupported ? 'is' : 'is not'} supported`);
|
||||
|
||||
// 8. Initial UI Update based on loaded state
|
||||
// 9. Initial UI Update based on loaded state
|
||||
ui.renderPlayers();
|
||||
ui.updateGameButton();
|
||||
|
||||
// 9. Reset running state to paused on load
|
||||
// 10. Reset running state to paused on load
|
||||
if (state.getGameState() === config.GAME_STATES.RUNNING) {
|
||||
console.log("Game was running on load, setting to paused.");
|
||||
state.setGameState(config.GAME_STATES.PAUSED);
|
||||
|
||||
Reference in New Issue
Block a user