@applicaster/zapp-react-dom-app 15.1.15 → 15.1.16-alpha.5293677506

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.
@@ -207,7 +207,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
207
207
  }
208
208
 
209
209
  componentWillUnmount() {
210
- window.removeEventListener("keydown", this.onKeyDownListener);
210
+ window.removeEventListener("keydown", this.onKeyDownListener, true);
211
211
  window.removeEventListener("keyup", this.onKeyUp);
212
212
  document.removeEventListener("wheel", this.onScrollListener);
213
213
 
@@ -423,7 +423,17 @@ class InteractionManagerClass extends React.Component<Props, State> {
423
423
 
424
424
  const action = backToTopAction();
425
425
 
426
- switch (displayState) {
426
+ const effectiveDisplayState = this.getEffectiveDisplayState();
427
+
428
+ // TEMP(native-controls): remove after device verification
429
+ if (effectiveDisplayState !== displayState) {
430
+ log_debug("[NativeControls] Back handled as PLAYER", {
431
+ displayState,
432
+ action,
433
+ });
434
+ }
435
+
436
+ switch (effectiveDisplayState) {
427
437
  case DISPLAY_STATES.DEFAULT:
428
438
  if (action === "PLATFORM_BACK") {
429
439
  log_info(action);
@@ -523,8 +533,42 @@ class InteractionManagerClass extends React.Component<Props, State> {
523
533
  this.onBackPress(event);
524
534
  }
525
535
 
536
+ // True only while the active (primary) player renders its own controls.
537
+ isNativePlayerControlsEnabled = () =>
538
+ !!playerManager.getInstanceController?.()?.supportsNativeControls?.();
539
+
540
+ // PLAYER/HUD are set by QuickBrick's TV transport controls, which are not
541
+ // mounted when the player renders native controls — the state would stay
542
+ // DEFAULT and keys would reach the screen behind the player (Enter re-opens it).
543
+ // The play-next overlay is the exception: it is QuickBrick UI, so the real
544
+ // state applies and Enter presses the focused overlay button.
545
+ getEffectiveDisplayState = () =>
546
+ this.isNativePlayerControlsEnabled() && !this.isPlayNextOverlayVisible()
547
+ ? DISPLAY_STATES.PLAYER
548
+ : this.props.displayState;
549
+
550
+ // True when the player closed something of its own instead.
551
+ playerConsumesBack = () =>
552
+ !!playerManager.getInstanceController?.()?.handlesBackKey?.();
553
+
554
+ // While the play-next overlay is up it owns the remote: its buttons are
555
+ // QuickBrick focusables, so the keys must not go to the player's own controls.
556
+ isPlayNextOverlayVisible = () =>
557
+ !!this.props.navigator?.getPlayNextOverlay?.();
558
+
559
+ shouldDeferPlaybackNavigationToNativeControls = (event: KeyboardEvent) => {
560
+ return (
561
+ this.isNativePlayerControlsEnabled() &&
562
+ !this.isPlayNextOverlayVisible() &&
563
+ (keyCode(event).matchesAny(...ARROW_KEYS) ||
564
+ keyCode(event).matches(KEYS.Enter) ||
565
+ (__DEV__ && keyCode(event).matches(KEYS.X)))
566
+ );
567
+ };
568
+
526
569
  onKeyDown(event) {
527
- const { displayState, setDisplayState, navigator, xray } = this.props;
570
+ const { setDisplayState, navigator, xray } = this.props;
571
+ const displayState = this.getEffectiveDisplayState();
528
572
  const { isDialogVisible } = confirmationDialogStore.getState();
529
573
  const { isKeyboardVisible } = this.state;
530
574
 
@@ -542,6 +586,12 @@ class InteractionManagerClass extends React.Component<Props, State> {
542
586
  }
543
587
 
544
588
  if (keyCode(event).matchesAny(KEYS.Back, KEYS.Escape, KEYS.EscapeDevice)) {
589
+ // A player with native controls can have something of its own open that
590
+ // Back should close first (e.g. an ad click-through overlay).
591
+ if (this.isNativePlayerControlsEnabled() && this.playerConsumesBack()) {
592
+ return;
593
+ }
594
+
545
595
  this.onBackPress(event);
546
596
 
547
597
  return;
@@ -554,6 +604,21 @@ class InteractionManagerClass extends React.Component<Props, State> {
554
604
  // Only handle repeat events for arrow keys
555
605
  if (event.repeat && !keyCode(event).matchesAny(...ARROW_KEYS)) return;
556
606
 
607
+ if (
608
+ !isDialogVisible &&
609
+ this.shouldDeferPlaybackNavigationToNativeControls(event)
610
+ ) {
611
+ // The player's own spatial navigation handles these keys.
612
+ // TEMP(native-controls): remove after device verification
613
+ log_debug("[NativeControls] key deferred to player", {
614
+ key: event.key,
615
+ displayState,
616
+ activeElement: document.activeElement?.className,
617
+ });
618
+
619
+ return;
620
+ }
621
+
557
622
  /**
558
623
  When the player is displayed, we listen to Native Play / Pause / Stop
559
624
  buttons. Any other key press will display the transport controls
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "15.1.15",
3
+ "version": "15.1.16-alpha.5293677506",
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": "15.1.15",
26
- "@applicaster/zapp-react-native-bridge": "15.1.15",
27
- "@applicaster/zapp-react-native-redux": "15.1.15",
28
- "@applicaster/zapp-react-native-ui-components": "15.1.15",
29
- "@applicaster/zapp-react-native-utils": "15.1.15",
25
+ "@applicaster/zapp-react-dom-ui-components": "15.1.16-alpha.5293677506",
26
+ "@applicaster/zapp-react-native-bridge": "15.1.16-alpha.5293677506",
27
+ "@applicaster/zapp-react-native-redux": "15.1.16-alpha.5293677506",
28
+ "@applicaster/zapp-react-native-ui-components": "15.1.16-alpha.5293677506",
29
+ "@applicaster/zapp-react-native-utils": "15.1.16-alpha.5293677506",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
31
  "typeface-montserrat": "^0.0.54",
32
32
  "video.js": "7.14.3",