@applicaster/zapp-react-native-utils 12.0.0-rc.34 → 12.0.0-rc.35

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.
@@ -270,7 +270,9 @@ export function HooksManager({
270
270
  });
271
271
 
272
272
  const isHookInHomescreen = payload?.home;
273
- const isHookFlowBlocker = hookPlugin?.module?.isFlowBlocker();
273
+
274
+ const isHookFlowBlocker =
275
+ hookPlugin?.module?.isFlowBlocker?.() ?? false;
274
276
 
275
277
  // TODO: We technically need to also support the case where there is more than one hook in the stack,
276
278
  // if needed we could add differentiation explicit user cancellation (when we should go to background) and other types of cancellation
@@ -20,6 +20,11 @@ export enum SharedPlayerCallBacksKeys {
20
20
  OnPlayerMute = "onPlayerMute",
21
21
  OnPlayerUnmute = "onPlayerUnmute",
22
22
 
23
+ onVideoFullscreenPlayerDidDismiss = "onVideoFullscreenPlayerDidDismiss",
24
+ onVideoFullscreenPlayerDidPresent = "onVideoFullscreenPlayerDidPresent",
25
+ onVideoFullscreenPlayerWillDismiss = "onVideoFullscreenPlayerWillDismiss",
26
+ onVideoFullscreenPlayerWillPresent = "onVideoFullscreenPlayerWillPresent",
27
+
23
28
  OnAdBegin = "onAdBegin",
24
29
  OnAdBreakBegin = "onAdBreakBegin",
25
30
  OnAdBreakEnd = "onAdBreakEnd",
@@ -414,6 +414,32 @@ export class Player {
414
414
  });
415
415
  };
416
416
 
417
+ onVideoFullscreenPlayerWillDismiss = () => {
418
+ this.invokeListenersUpdate({
419
+ callbackName:
420
+ SharedPlayerCallBacksKeys.onVideoFullscreenPlayerWillDismiss,
421
+ });
422
+ };
423
+
424
+ onVideoFullscreenPlayerDidDismiss = () => {
425
+ this.invokeListenersUpdate({
426
+ callbackName: SharedPlayerCallBacksKeys.onVideoFullscreenPlayerDidDismiss,
427
+ });
428
+ };
429
+
430
+ onVideoFullscreenPlayerWillPresent = () => {
431
+ this.invokeListenersUpdate({
432
+ callbackName:
433
+ SharedPlayerCallBacksKeys.onVideoFullscreenPlayerWillPresent,
434
+ });
435
+ };
436
+
437
+ onVideoFullscreenPlayerDidPresent = () => {
438
+ this.invokeListenersUpdate({
439
+ callbackName: SharedPlayerCallBacksKeys.onVideoFullscreenPlayerDidPresent,
440
+ });
441
+ };
442
+
417
443
  public invokeListenersUpdate = ({
418
444
  callbackName,
419
445
  event = {},
@@ -634,6 +660,12 @@ export class Player {
634
660
  onBufferStart: this.onBufferStart,
635
661
  onBufferComplete: this.onBufferComplete,
636
662
 
663
+ onPlayerClose: this.onPlayerClose,
664
+ onVideoFullscreenPlayerWillPresent: this.onVideoFullscreenPlayerWillPresent,
665
+ onVideoFullscreenPlayerDidPresent: this.onVideoFullscreenPlayerDidPresent,
666
+ onVideoFullscreenPlayerWillDismiss: this.onVideoFullscreenPlayerWillDismiss,
667
+ onVideoFullscreenPlayerDidDismiss: this.onVideoFullscreenPlayerDidDismiss,
668
+
637
669
  // Ads Callbacks:
638
670
  onAdBegin: this.onAdBegin,
639
671
  onAdBreakBegin: this.onAdBreakBegin,
@@ -693,4 +725,6 @@ export class Player {
693
725
  isFullScreenSupported(): boolean {
694
726
  return true;
695
727
  }
728
+
729
+ public supportsNativeControls = (): boolean => false;
696
730
  }
@@ -5,6 +5,7 @@ import { Player } from "./player";
5
5
  import { findNodeHandle, NativeModules } from "react-native";
6
6
  import { isApplePlatform } from "../../reactUtils";
7
7
  import { PlayerRole } from "./conts";
8
+ import { toBooleanWithDefaultFalse } from "../../booleanUtils";
8
9
 
9
10
  const RNPlayerManager = {
10
11
  QuickBrickPlayerPlugin: isApplePlatform()
@@ -291,4 +292,7 @@ export class PlayerNative extends Player {
291
292
 
292
293
  return !(isFullScreenAudioPlayer && this.isAudioItem());
293
294
  };
295
+
296
+ supportsNativeControls = (): boolean =>
297
+ toBooleanWithDefaultFalse(this.getConfig()?.["supports_native_controls"]);
294
298
  }
@@ -182,8 +182,8 @@ export const getHeight = (width, aspectRatio) => {
182
182
  * @returns {string} duration
183
183
  */
184
184
 
185
- export const getDurationInMinutes = (seconds: number): string => {
186
- if (seconds === (null || undefined)) return "00:00";
185
+ export const getDurationInMinutes = (seconds?: number): string => {
186
+ if (!seconds) return "00:00";
187
187
  const minutes = Math.floor(Number(seconds) / 60);
188
188
  const secondsReminder = Math.floor(Number(seconds)) % 60;
189
189
  const pad = (num: number): string => `${num < 10 ? "0" : ""}${num}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.0-rc.34",
3
+ "version": "12.0.0-rc.35",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "12.0.0-rc.34",
31
+ "@applicaster/applicaster-types": "12.0.0-rc.35",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -212,7 +212,8 @@ export const useRoute = (): {
212
212
 
213
213
  if (isHookPathname(pathname)) {
214
214
  const screenData =
215
- "hookPlugin" in currentRouteScreenData
215
+ "hookPlugin" in currentRouteScreenData &&
216
+ currentRouteScreenData.hookPlugin.screen_id
216
217
  ? currentRouteScreenData
217
218
  : navigator.screenData;
218
219
 
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
3
3
  import * as R from "ramda";
4
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
4
5
 
5
6
  export function getTargetScreenData(
6
7
  entry: ZappEntry,
@@ -35,6 +36,12 @@ export function getTargetScreenData(
35
36
  return rivers?.[screenId];
36
37
  }
37
38
 
39
+ export function getTargetScreenDataFromEntry(entry: ZappEntry): ZappRiver {
40
+ const { rivers, contentTypes } = appStore.get(["rivers", "contentTypes"]);
41
+
42
+ return getTargetScreenData(entry, rivers, contentTypes);
43
+ }
44
+
38
45
  export const useTargetScreenData = (entry: ZappEntry) => {
39
46
  const { rivers, contentTypes } = usePickFromState(["rivers", "contentTypes"]);
40
47