@applicaster/zapp-react-dom-app 13.0.0-alpha.8362430079 → 13.0.0-alpha.8532113155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,10 +31,7 @@ import {
31
31
  import { PlayerContentContext } from "@applicaster/zapp-react-dom-ui-components/Contexts";
32
32
 
33
33
  import { withNavigator } from "@applicaster/zapp-react-native-ui-components/Decorators/Navigator";
34
- import {
35
- getXray,
36
- createLogger,
37
- } from "@applicaster/zapp-react-native-utils/logger";
34
+ import { getXray } from "@applicaster/zapp-react-native-utils/logger";
38
35
 
39
36
  import {
40
37
  confirmationDialogStore,
@@ -54,11 +51,6 @@ import { KeyInputHandler } from "@applicaster/zapp-react-native-utils/appUtils/k
54
51
  const { withXray } = getXray();
55
52
  const globalAny: any = global;
56
53
 
57
- const { log_debug, log_warning } = createLogger({
58
- category: "InteractionManager",
59
- subsystem: "zapp-react-dom-app",
60
- });
61
-
62
54
  const shouldUseOnScreenKeyboard = () =>
63
55
  isVizioPlatform() || window.applicaster.useOnScreenKeyboard;
64
56
 
@@ -291,7 +283,8 @@ class InteractionManagerClass extends React.Component<Props, State> {
291
283
  this.handleWebOsBack();
292
284
  }
293
285
  } catch (e) {
294
- log_warning("Failed to execute platformBack", e);
286
+ // eslint-disable-next-line no-console
287
+ console.warn("Failed to execute platformBack", e);
295
288
  }
296
289
  }
297
290
 
@@ -385,103 +378,23 @@ class InteractionManagerClass extends React.Component<Props, State> {
385
378
  }
386
379
  }
387
380
 
388
- /**
389
- When pressing escape or the Native "Back" button:
390
- if on the transport controls: we show the player
391
- if on the player : we show the UI
392
- if on the UI : we exit the app
393
- note: backspace affects the keyboard input, so it behaves differently
394
- */
395
- onBackPress(event) {
381
+ onKeyDown(event) {
396
382
  const { displayState, setDisplayState, navigator } = this.props;
397
- const { isDialogVisible } = confirmationDialogStore.getState();
398
383
  const { isKeyboardVisible } = this.state;
399
384
 
400
- log_debug("onBackPress", {
401
- eventCode: event.code,
402
- displayState,
403
- isDialogVisible,
404
- isKeyboardVisible,
405
- });
385
+ const { isDialogVisible } = confirmationDialogStore.getState();
406
386
 
407
387
  if (isKeyboardVisible && shouldUseOnScreenKeyboard()) {
408
- this.handleKeyboardDismiss();
388
+ if (keyCode(event).matchesAny("Escape", "Back")) {
389
+ this.handleKeyboardDismiss();
390
+ }
391
+
409
392
  event.preventDefault();
410
393
  event.stopPropagation();
411
394
 
412
395
  return;
413
396
  }
414
397
 
415
- switch (displayState) {
416
- case DISPLAY_STATES.DEFAULT:
417
- case DISPLAY_STATES.PLAYER:
418
- if (isDialogVisible) {
419
- this.onConfirmDialogClose();
420
- } else if (navigator.canGoBack()) {
421
- navigator.goBack();
422
- } else if (this.isHomeScreen()) {
423
- this.platformBack();
424
- } else if (navigator.currentRoute.includes("hook")) {
425
- // If code reaches this block navigator cant go back, it is not home,
426
- // and this is a login plugin that was pushed on top of the home
427
- // Treat it like a home screen and run platformBack()
428
- const entryData = navigator?.data?.entry;
429
- const isHookInHomescreen = entryData?.payload?.home;
430
-
431
- const isHookFlowBlocker =
432
- typeof entryData?.hookPlugin?.module?.isFlowBlocker === "function"
433
- ? entryData?.hookPlugin?.module?.isFlowBlocker()
434
- : entryData?.hookPlugin?.module?.isFlowBlocker;
435
-
436
- if (isHookInHomescreen && isHookFlowBlocker) {
437
- this.platformBack();
438
- } else {
439
- navigator.goBack(false, true);
440
- }
441
- } else {
442
- this.goToHome();
443
- }
444
-
445
- break;
446
- case DISPLAY_STATES.HUD:
447
- // IF transport controls are open, close them instead of closing player
448
- setDisplayState(DISPLAY_STATES.PLAYER);
449
- break;
450
- default:
451
- setDisplayState(DISPLAY_STATES.PLAYER);
452
- break;
453
- }
454
- }
455
-
456
- onBackspacePress(event) {
457
- const isInputFocused =
458
- document.activeElement instanceof HTMLInputElement ||
459
- document.activeElement instanceof HTMLTextAreaElement;
460
-
461
- // Don't handle backspace if input is focused
462
- if (isInputFocused) {
463
- return;
464
- }
465
-
466
- this.onBackPress(event);
467
- }
468
-
469
- onKeyDown(event) {
470
- const { displayState, setDisplayState, navigator } = this.props;
471
- const { isDialogVisible } = confirmationDialogStore.getState();
472
-
473
- if (keyCode(event).matches("Backspace")) {
474
- this.onBackspacePress(event);
475
-
476
- return;
477
- }
478
-
479
- if (keyCode(event).matchesAny(KEYS.Back, KEYS.Escape, KEYS.EscapeDevice)) {
480
- this.onBackPress(event);
481
-
482
- return;
483
- }
484
-
485
398
  if (this.keySupportsLongPress(event)) {
486
399
  this.longPressDetector.monitorKeyPress(event.code, event);
487
400
  }
@@ -547,6 +460,55 @@ class InteractionManagerClass extends React.Component<Props, State> {
547
460
  }
548
461
  }
549
462
 
463
+ /**
464
+ When pressing escape or the Native "Back" button:
465
+ if on the transport controls: we show the player
466
+ if on the player : we show the UI
467
+ if on the UI : we exit the app
468
+ note: backspace affects the keyboard input, so it not handled here
469
+ */
470
+ if (keyCode(event).matchesAny(KEYS.Back, KEYS.Escape, KEYS.EscapeDevice)) {
471
+ switch (displayState) {
472
+ case DISPLAY_STATES.DEFAULT:
473
+ case DISPLAY_STATES.PLAYER:
474
+ if (isDialogVisible) {
475
+ this.onConfirmDialogClose();
476
+ } else if (navigator.canGoBack()) {
477
+ navigator.goBack();
478
+ } else if (this.isHomeScreen()) {
479
+ this.platformBack();
480
+ } else if (navigator.currentRoute.includes("hook")) {
481
+ // If code reaches this block navigator cant go back, it is not home,
482
+ // and this is a login plugin that was pushed on top of the home
483
+ // Treat it like a home screen and run platformBack()
484
+ const entryData = navigator?.data?.entry;
485
+ const isHookInHomescreen = entryData?.payload?.home;
486
+
487
+ const isHookFlowBlocker =
488
+ typeof entryData?.hookPlugin?.module?.isFlowBlocker === "function"
489
+ ? entryData?.hookPlugin?.module?.isFlowBlocker()
490
+ : entryData?.hookPlugin?.module?.isFlowBlocker;
491
+
492
+ if (isHookInHomescreen && isHookFlowBlocker) {
493
+ this.platformBack();
494
+ } else {
495
+ navigator.goBack(false, true);
496
+ }
497
+ } else {
498
+ this.goToHome();
499
+ }
500
+
501
+ break;
502
+ case DISPLAY_STATES.HUD:
503
+ // IF transport controls are open, close them instead of closing player
504
+ setDisplayState(DISPLAY_STATES.PLAYER);
505
+ break;
506
+ default:
507
+ setDisplayState(DISPLAY_STATES.PLAYER);
508
+ break;
509
+ }
510
+ }
511
+
550
512
  if (
551
513
  keyCode(event).matches(KEYS.Enter) ||
552
514
  (__DEV__ && keyCode(event).matches(KEYS.X))
@@ -571,7 +533,10 @@ class InteractionManagerClass extends React.Component<Props, State> {
571
533
  this.platformBack();
572
534
  }
573
535
 
574
- if (keyCode(event).matchesAny(...ARROW_KEYS)) {
536
+ if (
537
+ keyCode(event).matchesAny(...ARROW_KEYS) &&
538
+ !this.state.isKeyboardVisible
539
+ ) {
575
540
  if (displayState === DISPLAY_STATES.PLAYER) {
576
541
  setDisplayState(DISPLAY_STATES.HUD);
577
542
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "13.0.0-alpha.8362430079",
3
+ "version": "13.0.0-alpha.8532113155",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "homepage": "https://github.com/applicaster/zapp-react-dom-app#readme",
24
24
  "dependencies": {
25
- "@applicaster/zapp-react-dom-ui-components": "13.0.0-alpha.8362430079",
26
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.8362430079",
27
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.8362430079",
28
- "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.8362430079",
29
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.8362430079",
25
+ "@applicaster/zapp-react-dom-ui-components": "13.0.0-alpha.8532113155",
26
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.8532113155",
27
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.8532113155",
28
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.8532113155",
29
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.8532113155",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
31
  "react-router-dom": "^5.1.2",
32
32
  "typeface-montserrat": "^0.0.54",