()
| 324 | } |
| 325 | |
| 326 | async function startApp(): Promise<void> { |
| 327 | if (window.initialTheme === ThemeType.light) { |
| 328 | document.body.classList.add('light-theme'); |
| 329 | } |
| 330 | if (window.initialTheme === ThemeType.dark) { |
| 331 | document.body.classList.add('dark-theme'); |
| 332 | } |
| 333 | |
| 334 | const idleDetector = new IdleDetector(); |
| 335 | |
| 336 | await KeyboardLayout.initialize(); |
| 337 | |
| 338 | StartupQueue.initialize(); |
| 339 | notificationService.initialize({ |
| 340 | i18n, |
| 341 | storage: itemStorage, |
| 342 | }); |
| 343 | |
| 344 | await initializeMessageCounter(); |
| 345 | |
| 346 | // Initialize WebAPI as early as possible |
| 347 | let messageReceiver: MessageReceiver | undefined; |
| 348 | let routineProfileRefresher: RoutineProfileRefresher | undefined; |
| 349 | |
| 350 | ourProfileKeyService.initialize(itemStorage); |
| 351 | |
| 352 | window.SignalContext.activeWindowService.registerForChange(isActive => { |
| 353 | if (!isActive) { |
| 354 | window.reduxActions?.stories.setHasAllStoriesUnmuted(false); |
| 355 | } |
| 356 | }); |
| 357 | |
| 358 | let resolveOnAppView: (() => void) | undefined; |
| 359 | const onAppView = new Promise<void>(resolve => { |
| 360 | resolveOnAppView = resolve; |
| 361 | }); |
| 362 | |
| 363 | const reconnectBackOff = new BackOff(FIBONACCI_TIMEOUTS); |
| 364 | |
| 365 | const eventHandlerQueue = new PQueue({ |
| 366 | concurrency: 1, |
| 367 | }); |
| 368 | |
| 369 | // Note: this queue is meant to allow for stop/start of tasks, not limit parallelism. |
| 370 | const profileKeyResponseQueue = new PQueue(); |
| 371 | profileKeyResponseQueue.pause(); |
| 372 | |
| 373 | const onDecryptionErrorQueue = new PQueue({ concurrency: 1 }); |
| 374 | onDecryptionErrorQueue.pause(); |
| 375 | |
| 376 | const onRetryRequestQueue = new PQueue({ concurrency: 1 }); |
| 377 | onRetryRequestQueue.pause(); |
| 378 | |
| 379 | if (window.platform === 'darwin') { |
| 380 | window.addEventListener('dblclick', (event: Event) => { |
| 381 | const target = event.target as HTMLElement; |
| 382 | if (isWindowDragElement(target)) { |
| 383 | window.IPC.titleBarDoubleClick(); |
nothing calls this directly
no test coverage detected