@applicaster/zapp-react-native-utils 13.0.0-alpha.5371423120 → 13.0.0-alpha.5855333506

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.
Files changed (105) hide show
  1. package/actionsExecutor/ActionExecutor.ts +13 -9
  2. package/actionsExecutor/ActionExecutorContext.tsx +70 -7
  3. package/alertUtils/alert.ts +148 -0
  4. package/alertUtils/index.ts +1 -148
  5. package/analyticsUtils/AnalyticPlayerListener.ts +18 -1
  6. package/analyticsUtils/__tests__/__snapshots__/analyticsManagerNoModule.test.js.snap +9 -9
  7. package/analyticsUtils/helpers/hooks.ts +1 -1
  8. package/appUtils/HooksManager/{Hook.js → Hook.ts} +35 -23
  9. package/appUtils/HooksManager/__tests__/__snapshots__/hook.test.js.snap +10 -8
  10. package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +693 -0
  11. package/appUtils/HooksManager/__tests__/hook.test.js +196 -184
  12. package/appUtils/HooksManager/__tests__/hooksManager.test.js +96 -99
  13. package/appUtils/HooksManager/{constants.js → constants.ts} +1 -1
  14. package/appUtils/HooksManager/{index.js → index.ts} +121 -112
  15. package/appUtils/HooksManager/types.ts +119 -0
  16. package/appUtils/RiverFocusManager/index.js +17 -12
  17. package/appUtils/accessibilityManager/index.ts +42 -1
  18. package/appUtils/contextKeysManager/contextResolver.ts +73 -0
  19. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +6 -6
  20. package/appUtils/focusManager/index.ts +90 -63
  21. package/appUtils/focusManager/treeDataStructure/Tree/index.js +25 -3
  22. package/appUtils/focusManager/treeDataStructure/Utils/index.js +1 -3
  23. package/appUtils/focusManager/utils/enums.ts +4 -0
  24. package/appUtils/focusManagerAux/utils/index.ts +4 -3
  25. package/appUtils/{index.js → index.ts} +1 -1
  26. package/appUtils/keyCodes/__tests__/__snapshots__/keyCodes.test.js.snap +2 -2
  27. package/appUtils/keyCodes/__tests__/keyCodes.test.js +4 -4
  28. package/appUtils/keyCodes/{index.js → index.ts} +2 -0
  29. package/appUtils/keyCodes/keys/index.ts +3 -0
  30. package/appUtils/keyCodes/{keys.android.js → keys/keyEventMapper.ts} +0 -19
  31. package/appUtils/keyCodes/keys/keys.android.ts +18 -0
  32. package/appUtils/keyCodes/keys/keys.ios.ts +25 -0
  33. package/appUtils/keyCodes/keys/keys.ts +15 -0
  34. package/appUtils/keyCodes/{keysByPlatform.js → keys/keysByPlatform.ts} +4 -0
  35. package/appUtils/keyCodes/keysByPlatform.ts +8 -0
  36. package/appUtils/keyInputHandler/KeyInputHandler.ts +68 -0
  37. package/appUtils/orientationHelper.ts +1 -1
  38. package/appUtils/platform/const.ts +14 -0
  39. package/appUtils/platform/platformUtils.ts +17 -15
  40. package/appUtils/playerManager/index.ts +6 -2
  41. package/appUtils/playerManager/player.ts +17 -5
  42. package/appUtils/playerManager/playerFactory.ts +5 -4
  43. package/appUtils/playerManager/playerNative.ts +3 -2
  44. package/appUtils/playerManager/usePlayerControllerSetup.tsx +3 -3
  45. package/arrayUtils/__tests__/__snapshots__/arrayUtils.test.ts.snap +4 -4
  46. package/domUtils/{cookieManager.js → cookieManager.ts} +1 -2
  47. package/functionUtils/__tests__/__snapshots__/functionUtils.test.js.snap +4 -4
  48. package/functionUtils/index.ts +15 -11
  49. package/logger/const.ts +9 -67
  50. package/manifestUtils/__tests__/createConfig.test.js +18 -16
  51. package/modalState/index.ts +1 -5
  52. package/navigationUtils/__tests__/__snapshots__/navigationUtils.test.js.snap +6 -6
  53. package/navigationUtils/__tests__/itemTypes.test.js +2 -2
  54. package/navigationUtils/__tests__/navigationUtils.test.js +2 -2
  55. package/navigationUtils/index.ts +14 -5
  56. package/package.json +3 -2
  57. package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
  58. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +1 -1
  59. package/reactHooks/cell-click/__tests__/index.test.js +10 -2
  60. package/reactHooks/cell-click/index.ts +7 -1
  61. package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +4 -4
  62. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +20 -13
  63. package/reactHooks/feed/useFeedLoader.tsx +12 -8
  64. package/reactHooks/feed/usePipesCacheReset.ts +5 -5
  65. package/reactHooks/flatList/__tests__/index.test.tsx +30 -21
  66. package/reactHooks/layout/__tests__/index.test.tsx +10 -10
  67. package/reactHooks/layout/useDimensions/helpers/__tests__/getInitialDimensions.native.test.js +14 -28
  68. package/reactHooks/navigation/__tests__/index.test.tsx +0 -4
  69. package/reactHooks/navigation/index.ts +29 -218
  70. package/reactHooks/navigation/useGetBottomTabBarHeight.ts +12 -0
  71. package/reactHooks/navigation/useGetNavBarTopBorderWidth.ts +14 -0
  72. package/reactHooks/navigation/useGetTabBarHeight.ts +12 -0
  73. package/reactHooks/navigation/useIsScreenActive.ts +17 -0
  74. package/reactHooks/navigation/useNavigationPluginData.ts +15 -0
  75. package/reactHooks/navigation/useNavigationType.ts +15 -0
  76. package/reactHooks/navigation/usePathname.ts +4 -0
  77. package/reactHooks/navigation/useRoute.ts +100 -0
  78. package/reactHooks/navigation/useUniqueRouteSuffix.ts +41 -0
  79. package/reactHooks/player/TVSeekControlller/ISeekController.ts +32 -0
  80. package/reactHooks/player/TVSeekControlller/LongPressSeekController.ts +71 -0
  81. package/reactHooks/player/TVSeekControlller/TVSeekController.ts +258 -0
  82. package/reactHooks/player/TVSeekControlller/TapSeekController.ts +53 -0
  83. package/reactHooks/player/__tests__/{useAutoSeek.test.tsx → useAutoSeek._test.tsx} +2 -3
  84. package/reactHooks/player/const.ts +0 -4
  85. package/reactHooks/player/index.ts +0 -6
  86. package/reactHooks/utils/index.ts +13 -0
  87. package/reactUtils/__tests__/reactUtils.test.js +10 -28
  88. package/reactUtils/createContext/__tests__/__snapshots__/helpers.test.js.snap +19 -19
  89. package/reactUtils/createContext/__tests__/__snapshots__/index.test.js.snap +2 -2
  90. package/reactUtils/createContext/__tests__/__snapshots__/provider.test.js.snap +3 -3
  91. package/reactUtils/createContext/__tests__/helpers.test.js +8 -8
  92. package/reactUtils/index.ts +0 -14
  93. package/theme/__mocks__/index.ts +4 -0
  94. package/time/Timer.ts +1 -1
  95. package/appUtils/keyCodes/keys.ios.js +0 -46
  96. package/reactHooks/player/useAutoSeek.tsx +0 -87
  97. package/reactHooks/player/useSeek.tsx +0 -66
  98. package/reactHooks/player/useTapSeek.tsx +0 -58
  99. /package/appUtils/HooksManager/{logger.js → logger.ts} +0 -0
  100. /package/appUtils/{directionHelper.js → directionHelper.ts} +0 -0
  101. /package/appUtils/keyCodes/{androidTVKeys.js → androidTVKeys.ts} +0 -0
  102. /package/appUtils/keyCodes/{keys.web.js → keys/keys.web.ts} +0 -0
  103. /package/appUtils/{localizationsHelper.js → localizationsHelper.ts} +0 -0
  104. /package/domUtils/{logger.js → logger.ts} +0 -0
  105. /package/reactHooks/player/__tests__/{useTapSeek.test.ts → useTapSeek._test.ts} +0 -0
@@ -17,9 +17,10 @@ class ActionExecutor {
17
17
 
18
18
  handleAction = async (
19
19
  action: ActionType,
20
- entry: ZappEntry = null
20
+ context?: Record<string, any>
21
21
  ): Promise<ActionResult> => {
22
22
  const handler = this.registeredActions[action.type];
23
+ const entry = context?.entry as ZappEntry;
23
24
 
24
25
  if (!handler) {
25
26
  log_error(
@@ -32,17 +33,17 @@ class ActionExecutor {
32
33
 
33
34
  log_debug(
34
35
  `handleAction: ${action.type}${
35
- entry ? `, entry id ${entry.id}, title: ${entry.title}` : ""
36
+ entry ? `, entry id ${entry?.id}, title: ${entry?.title}` : ""
36
37
  }`,
37
38
  { action, entry }
38
39
  );
39
40
 
40
41
  try {
41
- return handler(action, entry);
42
+ return handler(action, context);
42
43
  } catch (error) {
43
44
  log_error(
44
45
  `handleAction: error handling action type: ${action.type}, message: ${error.message}`,
45
- { action, entry, error }
46
+ { action, context, error }
46
47
  );
47
48
 
48
49
  throw error;
@@ -51,11 +52,11 @@ class ActionExecutor {
51
52
 
52
53
  handleActions = async (
53
54
  actionTypes: ActionType[],
54
- entry: ZappEntry = null
55
+ context?: Record<string, any>
55
56
  ): Promise<ActionResult> => {
56
57
  for (const action of actionTypes) {
57
58
  // TODO: Handle action result error
58
- const result = await this.handleAction(action, entry);
59
+ const result = await this.handleAction(action, context);
59
60
 
60
61
  if (result === ActionResult.Cancel) {
61
62
  log_info(`handleActions: action: ${action.type} canceled`);
@@ -67,7 +68,10 @@ class ActionExecutor {
67
68
  return ActionResult.Success;
68
69
  };
69
70
 
70
- handleEntryActions = async (entry: ZappEntry): Promise<ActionResult> => {
71
+ handleEntryActions = async (
72
+ entry: ZappEntry,
73
+ context?: Record<string, any>
74
+ ): Promise<ActionResult> => {
71
75
  const tapActions = entry.extensions?.tap_actions?.actions;
72
76
 
73
77
  if (!tapActions) {
@@ -77,7 +81,7 @@ class ActionExecutor {
77
81
  if (!Array.isArray(tapActions)) {
78
82
  log_error(
79
83
  `handleEntryActions: tapActions is not an array for id: ${entry.id} title: ${entry.title}`,
80
- { entry }
84
+ { context, entry }
81
85
  );
82
86
 
83
87
  return;
@@ -87,7 +91,7 @@ class ActionExecutor {
87
91
  return;
88
92
  }
89
93
 
90
- await this.handleActions(tapActions, entry);
94
+ await this.handleActions(tapActions, { ...context, entry });
91
95
  };
92
96
 
93
97
  unregisterAction = (actionType: string) => {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="@applicaster/applicaster-types" />
2
-
2
+ import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
3
3
  import React, { createContext, useMemo } from "react";
4
4
  import {
5
5
  actionExecutor as _actionExecutor,
@@ -12,24 +12,41 @@ import { showConfirmationDialog } from "../alertUtils";
12
12
  import { createCloudEvent, sendCloudEvent } from "../cloudEventsUtils";
13
13
  import { createLogger } from "../logger";
14
14
  import { StorageMultiSelectProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageMultiSelectProvider";
15
+ import { ACTIVE_LAYOUT_ID_STORAGE_KEY } from "@applicaster/quick-brick-core/App/remoteContextReloader/consts";
16
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
17
+ import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
18
+ import {
19
+ EntryResolver,
20
+ resolveObjectValues,
21
+ } from "../appUtils/contextKeysManager/contextResolver";
15
22
 
16
23
  const { log_error, log_info } = createLogger({
17
24
  subsystem: "ActionExecutorContext",
18
25
  category: "General",
19
26
  });
20
27
 
28
+ // TODO: move entry inside options and rename options to context
21
29
  type ActionExecutorContextType = {
22
30
  registerAction: (
23
31
  type: string,
24
- handler: (action: ActionType, entry: ZappEntry) => Promise<ActionResult>
32
+ handler: (
33
+ action: ActionType,
34
+ context?: Record<string, any>
35
+ ) => Promise<ActionResult>
25
36
  ) => void;
26
37
  unregisterAction: (type: string) => void;
27
- handleAction: (action: ActionType, entry: ZappEntry) => Promise<ActionResult>;
38
+ handleAction: (
39
+ action: ActionType,
40
+ context?: Record<string, any>
41
+ ) => Promise<ActionResult>;
28
42
  handleActions: (
29
43
  actions: ActionType[],
30
- entry: ZappEntry
44
+ context: Record<string, any>
45
+ ) => Promise<ActionResult>;
46
+ handleEntryActions: (
47
+ entry: ZappEntry,
48
+ context?: Record<string, any>
31
49
  ) => Promise<ActionResult>;
32
- handleEntryActions: (entry: ZappEntry) => Promise<ActionResult>;
33
50
  };
34
51
  type Props = {
35
52
  children: React.ReactNode;
@@ -44,6 +61,44 @@ const prepareDefaultActions = (actionExecutor) => {
44
61
  return ActionResult.Success;
45
62
  });
46
63
 
64
+ actionExecutor.registerAction(
65
+ "refreshComponent",
66
+ async (_action, context) => {
67
+ const dispatch = appStore.getDispatch();
68
+
69
+ log_info("handleAction: refreshComponent event");
70
+
71
+ const dataSource = context?.component?.data?.source;
72
+
73
+ // TODO: Later we can pass component ids to do refresh instead of current one
74
+ // TODO: In theory we should wait callback to complete, before completing the action, but now it's not needed
75
+ // TODO: handle focused item removal
76
+ dispatch(
77
+ loadPipesData(dataSource, {
78
+ silentRefresh: false,
79
+ clearCache: true,
80
+ callback: (_data) => {},
81
+ riverId: context?.screenData?.id,
82
+ })
83
+ );
84
+
85
+ return ActionResult.Success;
86
+ }
87
+ );
88
+
89
+ actionExecutor.registerAction("switchLayout", async (action) => {
90
+ log_info("handleAction: switchLayout event");
91
+
92
+ await localStorage.setItem(
93
+ ACTIVE_LAYOUT_ID_STORAGE_KEY,
94
+ action.options.layoutId
95
+ );
96
+
97
+ QuickBrickManager.sendQuickBrickEvent(QUICK_BRICK_EVENTS.FORCE_APP_RELOAD);
98
+
99
+ return ActionResult.Success;
100
+ });
101
+
47
102
  actionExecutor.registerAction("appRestart", async () => {
48
103
  log_info(`handleAction: ${QUICK_BRICK_EVENTS.FORCE_APP_RELOAD} event`);
49
104
 
@@ -66,13 +121,21 @@ const prepareDefaultActions = (actionExecutor) => {
66
121
  return confirmationPromise;
67
122
  });
68
123
 
69
- actionExecutor.registerAction("sendCloudEvent", async (action, entry) => {
124
+ actionExecutor.registerAction("sendCloudEvent", async (action, context) => {
70
125
  try {
71
126
  const options = action.options;
72
127
 
128
+ const entry = context?.entry || {};
129
+ const entryResolver = new EntryResolver(entry);
130
+
131
+ const data =
132
+ options?.data && options.inflateData
133
+ ? await resolveObjectValues(options.data, { entry: entryResolver })
134
+ : options?.data || entry;
135
+
73
136
  const cloudEvent = await createCloudEvent({
74
137
  type: options.type || "com.applicaster.selector.action.v1",
75
- data: options.data || entry,
138
+ data,
76
139
  subject: options.subject || entry?.id,
77
140
  });
78
141
 
@@ -0,0 +1,148 @@
1
+ import { Alert } from "react-native";
2
+ import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
3
+ import { confirmationDialogStore } from "@applicaster/zapp-react-native-ui-components/Contexts/ConfirmDialogState";
4
+
5
+ // #region "Alert Dialog"
6
+
7
+ const globalAny: any = global;
8
+
9
+ const showWebAlertDialog = ({ message, completion }: AlertWebDialog) => {
10
+ globalAny?.alert?.(message);
11
+ completion?.();
12
+ };
13
+
14
+ const showNativeAlertDialog = ({
15
+ title,
16
+ message,
17
+ okButtonText,
18
+ completion,
19
+ }: AlertDialogType) => {
20
+ Alert.alert(title, message, [
21
+ {
22
+ text: okButtonText,
23
+ onPress: completion,
24
+ },
25
+ ]);
26
+ };
27
+
28
+ export const showAlertDialog = ({
29
+ title,
30
+ message,
31
+ okButtonText,
32
+ completion,
33
+ }: AlertDialogType) => {
34
+ if (isWeb()) {
35
+ showWebAlertDialog({ message, completion });
36
+ } else {
37
+ showNativeAlertDialog({
38
+ title,
39
+ message,
40
+ okButtonText,
41
+ completion,
42
+ });
43
+ }
44
+ };
45
+
46
+ // #endregion "Alert Dialog"
47
+
48
+ // #region "Confirmation Dialog"
49
+
50
+ const showWebDialog = ({
51
+ message,
52
+ confirmCompletion,
53
+ cancelCompletion,
54
+ }: WebConfirmationDialog) => {
55
+ const isConfirmed = globalAny?.confirm?.(message);
56
+
57
+ if (isConfirmed) {
58
+ confirmCompletion?.();
59
+ } else {
60
+ cancelCompletion?.();
61
+ }
62
+ };
63
+
64
+ const showNativeDialog = ({
65
+ title,
66
+ message,
67
+ okButtonText,
68
+ cancelButtonText,
69
+ confirmCompletion,
70
+ cancelCompletion,
71
+ }: ConfirmationDialog) => {
72
+ Alert.alert(title, message, [
73
+ {
74
+ text: cancelButtonText,
75
+ onPress: cancelCompletion,
76
+ },
77
+ {
78
+ text: okButtonText,
79
+ style: "destructive",
80
+ onPress: confirmCompletion,
81
+ },
82
+ ]);
83
+ };
84
+
85
+ const handleCustomDialog = (data) => {
86
+ const {
87
+ showDialog,
88
+ hideDialog,
89
+ setConfirmAction,
90
+ setCancelAction,
91
+ setMessages,
92
+ } = confirmationDialogStore.getState();
93
+
94
+ setMessages(data.messages);
95
+
96
+ if (data?.cancelCompletion) {
97
+ setCancelAction(() => {
98
+ data.cancelCompletion();
99
+ hideDialog();
100
+ });
101
+ }
102
+
103
+ if (data?.confirmCompletion) {
104
+ setConfirmAction(() => {
105
+ data.confirmCompletion();
106
+ hideDialog();
107
+ });
108
+ }
109
+
110
+ showDialog();
111
+ };
112
+
113
+ export const showConfirmationDialog = ({
114
+ title,
115
+ message,
116
+ okButtonText,
117
+ cancelButtonText,
118
+ confirmCompletion,
119
+ cancelCompletion,
120
+ }: CustomConfirmationDialog): void => {
121
+ if (isWeb()) {
122
+ if (cancelCompletion) {
123
+ handleCustomDialog({
124
+ messages: {
125
+ title,
126
+ message,
127
+ okButtonText,
128
+ cancelButtonText,
129
+ },
130
+ confirmCompletion,
131
+ cancelCompletion,
132
+ });
133
+ } else {
134
+ showWebDialog({ message, confirmCompletion, cancelCompletion });
135
+ }
136
+ } else {
137
+ showNativeDialog({
138
+ title,
139
+ message,
140
+ okButtonText,
141
+ cancelButtonText,
142
+ confirmCompletion,
143
+ cancelCompletion,
144
+ });
145
+ }
146
+ };
147
+
148
+ // #endregion "Confirmation Dialog"
@@ -1,148 +1 @@
1
- import { Alert } from "react-native";
2
- import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
3
- import { confirmationDialogStore } from "@applicaster/zapp-react-native-ui-components/Contexts/ConfirmDialogState";
4
-
5
- // #region "Alert Dialog"
6
-
7
- const globalAny: any = global;
8
-
9
- const showWebAlertDialog = ({ message, completion }: AlertWebDialog) => {
10
- globalAny?.alert?.(message);
11
- completion?.();
12
- };
13
-
14
- const showNativeAlertDialog = ({
15
- title,
16
- message,
17
- okButtonText,
18
- completion,
19
- }: AlertDialogType) => {
20
- Alert.alert(title, message, [
21
- {
22
- text: okButtonText,
23
- onPress: completion,
24
- },
25
- ]);
26
- };
27
-
28
- export const showAlertDialog = ({
29
- title,
30
- message,
31
- okButtonText,
32
- completion,
33
- }: AlertDialogType) => {
34
- if (isWeb()) {
35
- showWebAlertDialog({ message, completion });
36
- } else {
37
- showNativeAlertDialog({
38
- title,
39
- message,
40
- okButtonText,
41
- completion,
42
- });
43
- }
44
- };
45
-
46
- // #endregion "Alert Dialog"
47
-
48
- // #region "Confirmation Dialog"
49
-
50
- const showWebDialog = ({
51
- message,
52
- confirmCompletion,
53
- cancelCompletion,
54
- }: WebConfirmationDialog) => {
55
- const isConfirmed = globalAny?.confirm?.(message);
56
-
57
- if (isConfirmed) {
58
- confirmCompletion?.();
59
- } else {
60
- cancelCompletion?.();
61
- }
62
- };
63
-
64
- const showNativeDialog = ({
65
- title,
66
- message,
67
- okButtonText,
68
- cancelButtonText,
69
- confirmCompletion,
70
- cancelCompletion,
71
- }: ConfirmationDialog) => {
72
- Alert.alert(title, message, [
73
- {
74
- text: cancelButtonText,
75
- onPress: cancelCompletion,
76
- },
77
- {
78
- text: okButtonText,
79
- style: "destructive",
80
- onPress: confirmCompletion,
81
- },
82
- ]);
83
- };
84
-
85
- const handleCustomDialog = (data) => {
86
- const {
87
- showDialog,
88
- hideDialog,
89
- setConfirmAction,
90
- setCancelAction,
91
- setMessages,
92
- } = confirmationDialogStore.getState();
93
-
94
- setMessages(data.messages);
95
-
96
- if (data?.cancelCompletion) {
97
- setCancelAction(() => {
98
- data.cancelCompletion();
99
- hideDialog();
100
- });
101
- }
102
-
103
- if (data?.confirmCompletion) {
104
- setConfirmAction(() => {
105
- data.confirmCompletion();
106
- hideDialog();
107
- });
108
- }
109
-
110
- showDialog();
111
- };
112
-
113
- export const showConfirmationDialog = ({
114
- title,
115
- message,
116
- okButtonText,
117
- cancelButtonText,
118
- confirmCompletion,
119
- cancelCompletion,
120
- }: CustomConfirmationDialog): void => {
121
- if (isWeb()) {
122
- if (cancelCompletion) {
123
- handleCustomDialog({
124
- messages: {
125
- title,
126
- message,
127
- okButtonText,
128
- cancelButtonText,
129
- },
130
- confirmCompletion,
131
- cancelCompletion,
132
- });
133
- } else {
134
- showWebDialog({ message, confirmCompletion, cancelCompletion });
135
- }
136
- } else {
137
- showNativeDialog({
138
- title,
139
- message,
140
- okButtonText,
141
- cancelButtonText,
142
- confirmCompletion,
143
- cancelCompletion,
144
- });
145
- }
146
- };
147
-
148
- // #endregion "Confirmation Dialog"
1
+ export { showAlertDialog, showConfirmationDialog } from "./alert";
@@ -14,7 +14,7 @@ export class AnalyticPlayerListener
14
14
  static analyticsListenerID = "analytics-listener";
15
15
  private analyticsTracker: PlayerAnalyticsTracker;
16
16
  private player: Player;
17
-
17
+ private isSeeking: boolean = false;
18
18
  private onVideoLoadCalled; // android only
19
19
 
20
20
  constructor(props: Props) {
@@ -40,10 +40,27 @@ export class AnalyticPlayerListener
40
40
  };
41
41
 
42
42
  onPlayerPause = (event) => {
43
+ if (this.player?.seekController?.isSeeking()) {
44
+ this.isSeeking = true;
45
+
46
+ return;
47
+ }
48
+
43
49
  this.handleAnalyticEvent(PLAYBACK_EVENT.pause, event);
44
50
  };
45
51
 
46
52
  onPlayerResume = (event) => {
53
+ if (this.player?.seekController?.isSeeking()) {
54
+ return;
55
+ }
56
+
57
+ if (this.isSeeking) {
58
+ // Fallback due to player resume event been async and arriving with delays
59
+ this.isSeeking = false;
60
+
61
+ return;
62
+ }
63
+
47
64
  this.handleAnalyticEvent(PLAYBACK_EVENT.play, event);
48
65
  };
49
66
 
@@ -1,24 +1,24 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`AnalyticsManager - with undefined Native Module doesn't crash when calling the methods 1`] = `
4
- Array [
5
- Array [
6
- Object {
4
+ [
5
+ [
6
+ {
7
7
  "message": "Analytics Bridge is missing - no event will be sent",
8
8
  },
9
9
  ],
10
- Array [
11
- Object {
10
+ [
11
+ {
12
12
  "message": "Analytics Bridge is missing - no event will be sent",
13
13
  },
14
14
  ],
15
- Array [
16
- Object {
15
+ [
16
+ {
17
17
  "message": "Analytics Bridge is missing - no event will be sent",
18
18
  },
19
19
  ],
20
- Array [
21
- Object {
20
+ [
21
+ {
22
22
  "message": "Analytics Bridge is missing - no event will be sent",
23
23
  },
24
24
  ],
@@ -2,7 +2,7 @@ import * as R from "ramda";
2
2
  import * as React from "react";
3
3
 
4
4
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
5
- import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
5
+ import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
6
6
 
7
7
  import { getAnalyticsScreenPropertiesFromScreenData } from "@applicaster/zapp-react-native-utils/analyticsUtils/currentScreenProperities";
8
8
  import { useAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils";