@applicaster/zapp-react-native-utils 12.0.11 → 12.0.12-alpha.1513691962
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.
|
@@ -72,12 +72,14 @@ const mappedScreenPropertiesScreen = (
|
|
|
72
72
|
screenData
|
|
73
73
|
): AnalyticsScreenProperties => {
|
|
74
74
|
return {
|
|
75
|
-
screen_name: screenData?.targetScreen?.name,
|
|
75
|
+
screen_name: screenData?.targetScreen?.name || screenData?.name,
|
|
76
76
|
screen_entry_title: screenData?.title,
|
|
77
77
|
screen_entry_id: R.isNil(screenData?.type) ? null : screenData?.id,
|
|
78
|
-
screen_layout_id: screenData?.targetScreen?.id,
|
|
79
|
-
screen_type: screenData?.targetScreen?.type,
|
|
80
|
-
home_screen: screenData?.targetScreen?.home
|
|
78
|
+
screen_layout_id: screenData?.targetScreen?.id || screenData?.id,
|
|
79
|
+
screen_type: screenData?.targetScreen?.type || screenData?.type,
|
|
80
|
+
home_screen: !R.isNil(screenData?.targetScreen?.home)
|
|
81
|
+
? screenData?.targetScreen?.home
|
|
82
|
+
: screenData?.home,
|
|
81
83
|
};
|
|
82
84
|
};
|
|
83
85
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import * as ReactNative from "react-native";
|
|
3
3
|
import { isTV, platformSelect } from "../reactUtils";
|
|
4
4
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
|
-
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
5
|
|
|
7
6
|
import {
|
|
8
7
|
QUICK_BRICK_EVENTS,
|
|
@@ -10,6 +9,7 @@ import {
|
|
|
10
9
|
sendQuickBrickEvent,
|
|
11
10
|
} from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
12
11
|
import { utilsLogger } from "../logger";
|
|
12
|
+
import { useIsTablet } from "../reactHooks";
|
|
13
13
|
|
|
14
14
|
const { DeviceEventEmitter, NativeModules, NativeEventEmitter } = ReactNative;
|
|
15
15
|
|
|
@@ -121,8 +121,15 @@ export const removeOrientationChangeListener = (listener: any): void => {
|
|
|
121
121
|
*/
|
|
122
122
|
export const isOrientationCompatible = ({
|
|
123
123
|
orientation,
|
|
124
|
-
layoutData: { width, height },
|
|
124
|
+
layoutData: { width, height, isTablet, isTabletPortrait },
|
|
125
125
|
}) => {
|
|
126
|
+
// We count portrait as compatible, because if default in zapp for mobile layout
|
|
127
|
+
// We count landscape as compatible, because if isTabletPortrait is false,
|
|
128
|
+
// it defaults for device
|
|
129
|
+
if (isTablet && !isTabletPortrait) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
|
|
126
133
|
const isLandscape = width > height;
|
|
127
134
|
|
|
128
135
|
if (
|
|
@@ -146,15 +153,6 @@ export const isOrientationCompatible = ({
|
|
|
146
153
|
return true;
|
|
147
154
|
};
|
|
148
155
|
|
|
149
|
-
export const useIsOrientationCompatible = (orientation) => {
|
|
150
|
-
const { height, width } = ReactNative.useWindowDimensions();
|
|
151
|
-
|
|
152
|
-
return isOrientationCompatible({
|
|
153
|
-
orientation,
|
|
154
|
-
layoutData: { width, height },
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
|
|
158
156
|
/**
|
|
159
157
|
* Determine final screen orientation based on device type,
|
|
160
158
|
* settings and orientation value provided by screen data settings
|
|
@@ -91,6 +91,7 @@ export class Player {
|
|
|
91
91
|
this.onVideoProgress = this.onVideoProgress.bind(this);
|
|
92
92
|
this.onVideoLoad = this.onVideoLoad.bind(this);
|
|
93
93
|
this.isFullScreenSupported = this.isFullScreenSupported.bind(this);
|
|
94
|
+
this.onAdBreakEnd = this.onAdBreakEnd.bind(this);
|
|
94
95
|
this.entryObservable = null;
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -194,17 +195,25 @@ export class Player {
|
|
|
194
195
|
adPosition: currentTime,
|
|
195
196
|
};
|
|
196
197
|
} else {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
this.updateContentDuration({ seekableDuration, duration, currentTime });
|
|
199
|
+
}
|
|
200
|
+
};
|
|
200
201
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
protected updateContentDuration = ({
|
|
203
|
+
seekableDuration = null,
|
|
204
|
+
duration = null,
|
|
205
|
+
currentTime = null,
|
|
206
|
+
}) => {
|
|
207
|
+
if (!isEmptyOrNil(seekableDuration) && seekableDuration >= 0) {
|
|
208
|
+
this.playerState.seekableDuration = seekableDuration;
|
|
209
|
+
}
|
|
204
210
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
if (!isEmptyOrNil(duration) && duration >= 0) {
|
|
212
|
+
this.playerState.contentDuration = duration;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (!isEmptyOrNil(currentTime) && currentTime >= 0) {
|
|
216
|
+
this.playerState.contentPosition = currentTime;
|
|
208
217
|
}
|
|
209
218
|
};
|
|
210
219
|
|
|
@@ -551,7 +560,7 @@ export class Player {
|
|
|
551
560
|
});
|
|
552
561
|
};
|
|
553
562
|
|
|
554
|
-
onAdBreakEnd
|
|
563
|
+
onAdBreakEnd(event) {
|
|
555
564
|
this.playerState.adState = null;
|
|
556
565
|
this.playerState.isInAdBreak = false;
|
|
557
566
|
|
|
@@ -559,7 +568,7 @@ export class Player {
|
|
|
559
568
|
callbackName: SharedPlayerCallBacksKeys.OnAdBreakEnd,
|
|
560
569
|
event,
|
|
561
570
|
});
|
|
562
|
-
}
|
|
571
|
+
}
|
|
563
572
|
|
|
564
573
|
onAdEnd = (event) => {
|
|
565
574
|
this.playerState.adState = null;
|
|
@@ -724,6 +733,10 @@ export class Player {
|
|
|
724
733
|
return null;
|
|
725
734
|
};
|
|
726
735
|
|
|
736
|
+
public hasResumePosition() {
|
|
737
|
+
return false;
|
|
738
|
+
}
|
|
739
|
+
|
|
727
740
|
public getConfig = () => this.config;
|
|
728
741
|
|
|
729
742
|
// TODO: replace with enum of supported orientations
|
|
@@ -54,6 +54,10 @@ export class PlayerNative extends Player {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
public hasResumePosition() {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
57
61
|
getContentPosition = () => {
|
|
58
62
|
return this.playerState.contentPosition;
|
|
59
63
|
};
|
|
@@ -221,8 +225,11 @@ export class PlayerNative extends Player {
|
|
|
221
225
|
};
|
|
222
226
|
|
|
223
227
|
onVideoLoad = (event) => {
|
|
224
|
-
|
|
228
|
+
this.updateContentDuration(event);
|
|
229
|
+
|
|
230
|
+
if (this.startPosition && !this.playerState.isInAdBreak) {
|
|
225
231
|
super.onVideoLoad({ ...event, ignoreContinueWatching: true });
|
|
232
|
+
|
|
226
233
|
this.seekTo(this.startPosition);
|
|
227
234
|
this.startPosition = null;
|
|
228
235
|
} else {
|
|
@@ -248,6 +255,15 @@ export class PlayerNative extends Player {
|
|
|
248
255
|
}
|
|
249
256
|
};
|
|
250
257
|
|
|
258
|
+
onAdBreakEnd = (event) => {
|
|
259
|
+
super.onAdBreakEnd(event);
|
|
260
|
+
|
|
261
|
+
if (this.startPosition) {
|
|
262
|
+
this.seekTo(this.startPosition);
|
|
263
|
+
this.startPosition = null;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
251
267
|
// This function is called when native player used directly without wrapped component,
|
|
252
268
|
// Since event from native comes with wrapped in NativeEvent property
|
|
253
269
|
getNativeViewListener = (): QuickBrickPlayer.SharedPlayerCallBacks => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.12-alpha.1513691962",
|
|
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.
|
|
31
|
+
"@applicaster/applicaster-types": "12.0.12-alpha.1513691962",
|
|
32
32
|
"buffer": "^5.2.1",
|
|
33
33
|
"camelize": "^1.0.0",
|
|
34
34
|
"create-react-context": "^0.2.3",
|
|
@@ -191,21 +191,23 @@ export function useInflatedUrl({
|
|
|
191
191
|
const [searchContext] = ZappPipesSearchContext.useZappPipesContext();
|
|
192
192
|
const [screenContext] = ZappPipesScreenContext.useZappPipesContext();
|
|
193
193
|
|
|
194
|
-
const url = useMemo(
|
|
195
|
-
()
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
194
|
+
const url = useMemo(() => {
|
|
195
|
+
if (!feedUrl) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return mapping
|
|
200
|
+
? getInflatedDataSourceUrl({
|
|
201
|
+
source: feedUrl,
|
|
202
|
+
contexts: {
|
|
203
|
+
entry: entryContext,
|
|
204
|
+
screen: screenContext,
|
|
205
|
+
search: getSearchContext(searchContext, mapping),
|
|
206
|
+
},
|
|
207
|
+
mapping,
|
|
208
|
+
})
|
|
209
|
+
: feedUrl;
|
|
210
|
+
}, [feedUrl, mapping]);
|
|
209
211
|
|
|
210
212
|
if (!feedUrl) {
|
|
211
213
|
logger.warning({
|