@applicaster/zapp-react-native-utils 14.0.0-alpha.5533663133 → 14.0.0-alpha.6242515303

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.
@@ -18,13 +18,6 @@ export const { log_verbose, log_debug, log_info, log_error } = createLogger({
18
18
  parent: utilsLogger,
19
19
  });
20
20
 
21
- type ActionChapter = {
22
- type: string;
23
- options?: {
24
- title: string;
25
- };
26
- };
27
-
28
21
  type ChapterMarkerOriginal = {
29
22
  id: string;
30
23
  title: string;
@@ -33,14 +26,6 @@ type ChapterMarkerOriginal = {
33
26
  actions: ActionChapter[];
34
27
  };
35
28
 
36
- export type ChapterMarkerEvent = {
37
- id: string;
38
- title: string;
39
- start_time: number;
40
- end_time: number;
41
- actions: ActionChapter[];
42
- };
43
-
44
29
  export type TitleSummaryEvent = {
45
30
  title: string | number;
46
31
  summary: string | number;
@@ -1,4 +1,3 @@
1
- import { ChapterMarkerEvent } from "./OverlayObserver/OverlaysObserver";
2
1
  import { usePlayer } from "./usePlayer";
3
2
  import * as React from "react";
4
3
 
@@ -5,6 +5,9 @@ import { playerManager } from "./index";
5
5
  import { useValidatePlayerConfig } from "../../playerUtils/useValidatePlayerConfig";
6
6
  import { PlayerRole } from "./conts";
7
7
  import { isAppleTV } from "@applicaster/zapp-react-native-ui-components/Helpers/Platform";
8
+ import { TVSeekController } from "../../reactHooks/player/TVSeekControlller/TVSeekController";
9
+ import { KeyInputHandler } from "../keyInputHandler/KeyInputHandler";
10
+ import { isTV } from "../../reactUtils";
8
11
 
9
12
  // TODO: Rename to ControllerType
10
13
  export const usePlayerControllerSetup = ({
@@ -76,5 +79,18 @@ export const usePlayerControllerSetup = ({
76
79
  };
77
80
  }, [playerId, playerController]);
78
81
 
82
+ useEffect(() => {
83
+ if (!isTV()) {
84
+ return;
85
+ }
86
+
87
+ if (playerController) {
88
+ const seekController = new TVSeekController(playerController);
89
+ playerController.seekController = seekController;
90
+
91
+ return KeyInputHandler.getInstance().addListener(seekController);
92
+ }
93
+ }, [playerController]);
94
+
79
95
  return playerController;
80
96
  };
@@ -176,18 +176,30 @@ class FocusManager {
176
176
  }
177
177
  }
178
178
 
179
- registerFocusable(
180
- component: FocusManager.TouchableReactRef,
181
- parentFocusable: FocusManager.TouchableReactRef,
182
- isFocusableCell: boolean
183
- ) {
184
- const focusableId = getFocusableId(component);
179
+ registerFocusable({
180
+ touchableRef,
181
+ parentFocusableRef,
182
+ isFocusableCell,
183
+ parentFocusableId,
184
+ }: {
185
+ touchableRef: FocusManager.TouchableReactRef;
186
+ parentFocusableRef: FocusManager.TouchableReactRef;
187
+ isFocusableCell: boolean;
188
+ parentFocusableId: string;
189
+ }) {
190
+ const focusableId = getFocusableId(touchableRef);
191
+
185
192
  const focusableComponent = FocusManager.findFocusable(focusableId);
186
193
 
187
- if (!focusableComponent && component) {
188
- this.focusableComponents.push(component);
194
+ if (!focusableComponent && touchableRef) {
195
+ this.focusableComponents.push(touchableRef);
189
196
 
190
- this.tree.add(component, parentFocusable, isFocusableCell);
197
+ this.tree.add(
198
+ touchableRef,
199
+ parentFocusableRef,
200
+ isFocusableCell,
201
+ parentFocusableId
202
+ );
191
203
  } else {
192
204
  logger.warning("Focusable component already registered", {
193
205
  id: focusableId,
@@ -267,7 +279,7 @@ class FocusManager {
267
279
 
268
280
  if (nextFocus) {
269
281
  // HACK: hack to fix the hack below
270
- // HACK: putting call to the end of the event loop so the next component has a chane to be registered
282
+ // HACK: putting call to the end of the event loop so the next component has a chance to be registered
271
283
  setTimeout(() => {
272
284
  FocusManager.instance.setFocus(nextFocus, {
273
285
  direction: "down",
@@ -8,37 +8,41 @@ export class Tree {
8
8
  this.tree = focusManagerTree;
9
9
  }
10
10
 
11
- add(component, parentFocusable, isFocusableCell) {
12
- const focusableId = getFocusableId(component);
13
- const parentId = getFocusableId(parentFocusable);
11
+ add(
12
+ touchableRef: FocusManager.TouchableReactRef,
13
+ parentFocusableRef: FocusManager.TouchableReactRef,
14
+ isFocusableCell: boolean,
15
+ parentFocusableId: string
16
+ ) {
17
+ const focusableId = getFocusableId(touchableRef);
18
+ const parentId = getFocusableId(parentFocusableRef) || parentFocusableId;
14
19
  const focusableComponentInTree = this.find(focusableId);
15
20
 
16
21
  // update node if it already exists
17
22
  if (focusableComponentInTree) {
18
- focusableComponentInTree.updateNode(component);
23
+ focusableComponentInTree.updateNode(touchableRef);
19
24
  }
20
25
 
21
- if (parentFocusable?.current) {
22
- if (!this.find(parentId)) {
23
- this.tree.push(new TreeNode(null, parentId, null, isFocusableCell));
24
- }
26
+ if (!this.find(parentId)) {
27
+ // create temporary node to the root of the tree
28
+ this.tree.push(new TreeNode(null, parentId, null, isFocusableCell));
29
+ }
25
30
 
26
- const parentNode = this.find(parentId);
31
+ const parentNode = this.find(parentId);
27
32
 
28
- if (parentNode) {
29
- if (focusableComponentInTree) {
30
- focusableComponentInTree.isFocusableCell = isFocusableCell;
31
- focusableComponentInTree.parentId = parentNode.id;
33
+ if (parentNode) {
34
+ if (focusableComponentInTree) {
35
+ focusableComponentInTree.isFocusableCell = isFocusableCell;
36
+ focusableComponentInTree.parentId = parentNode.id;
32
37
 
33
- parentNode.addChild(focusableComponentInTree);
38
+ parentNode.addChild(focusableComponentInTree);
34
39
 
35
- // remove root object from the list
36
- this.tree = this.tree.filter(
37
- (node) => node !== focusableComponentInTree
38
- );
39
- } else {
40
- parentNode.addChild(component, focusableId, isFocusableCell);
41
- }
40
+ // remove root object from the list
41
+ this.tree = this.tree.filter(
42
+ (node) => node !== focusableComponentInTree
43
+ );
44
+ } else {
45
+ parentNode.addChild(touchableRef, focusableId, isFocusableCell);
42
46
  }
43
47
  }
44
48
  }
@@ -1,5 +1,8 @@
1
1
  import { focusManager } from "../FocusManager";
2
2
 
3
+ const isFocusableCell = true;
4
+ const parentFocusableId = "parentFocusableId";
5
+
3
6
  const group = {
4
7
  current: {
5
8
  props: {
@@ -62,13 +65,47 @@ jest.useFakeTimers();
62
65
 
63
66
  describe("FocusManager", () => {
64
67
  beforeAll(() => {
65
- focusManager.registerFocusable(group, { current: null });
66
- focusManager.registerFocusable(child1, group);
67
- focusManager.registerFocusable(child2, group);
68
- focusManager.registerFocusable(child3, child2);
69
-
70
- focusManager.registerFocusable(child4, child2);
71
- focusManager.registerFocusable(child5, child2);
68
+ focusManager.registerFocusable({
69
+ touchableRef: group,
70
+ parentFocusableRef: { current: null },
71
+ isFocusableCell,
72
+ parentFocusableId,
73
+ });
74
+
75
+ focusManager.registerFocusable({
76
+ touchableRef: child1,
77
+ parentFocusableRef: group,
78
+ isFocusableCell,
79
+ parentFocusableId,
80
+ });
81
+
82
+ focusManager.registerFocusable({
83
+ touchableRef: child2,
84
+ parentFocusableRef: group,
85
+ isFocusableCell,
86
+ parentFocusableId,
87
+ });
88
+
89
+ focusManager.registerFocusable({
90
+ touchableRef: child3,
91
+ parentFocusableRef: child2,
92
+ isFocusableCell,
93
+ parentFocusableId,
94
+ });
95
+
96
+ focusManager.registerFocusable({
97
+ touchableRef: child4,
98
+ parentFocusableRef: child2,
99
+ isFocusableCell,
100
+ parentFocusableId,
101
+ });
102
+
103
+ focusManager.registerFocusable({
104
+ touchableRef: child5,
105
+ parentFocusableRef: child2,
106
+ isFocusableCell,
107
+ parentFocusableId,
108
+ });
72
109
  });
73
110
 
74
111
  it("focusManager should be defined", () => {
@@ -199,7 +236,12 @@ describe("FocusManager", () => {
199
236
  });
200
237
 
201
238
  it("focusManager registerFocusable should register", () => {
202
- focusManager.registerFocusable(child5, child2);
239
+ focusManager.registerFocusable({
240
+ touchableRef: child5,
241
+ parentFocusableRef: child2,
242
+ isFocusableCell,
243
+ parentFocusableId,
244
+ });
203
245
 
204
246
  expect(
205
247
  focusManager.isFocusableChildOf(child5.current.props.id, child2)
@@ -351,6 +351,86 @@ function getPlayerConfiguration({ platform, version }) {
351
351
  ],
352
352
  },
353
353
  ]),
354
+ fieldsGroup(
355
+ "Partial Player (Roku only)",
356
+ "This section allows you to configure width and height of video player in Partial Player",
357
+ [
358
+ {
359
+ key: "video_theater_width",
360
+ label: "Width of player",
361
+ type: "number_input",
362
+ initial_value: "1420",
363
+ placeHolder: "1420",
364
+ },
365
+ {
366
+ key: "video_theater_height",
367
+ label: "Height of player",
368
+ type: "number_input",
369
+ initial_value: "900",
370
+ placeHolder: "900",
371
+ },
372
+ {
373
+ key: "full_screen_button_offset_x",
374
+ label: "Fullscreen button X",
375
+ type: "number_input",
376
+ initial_value: 160,
377
+ placeHolder: "160",
378
+ },
379
+ {
380
+ key: "full_screen_button_offset_y",
381
+ label: "Fullscreen button Y",
382
+ type: "number_input",
383
+ initial_value: 160,
384
+ placeHolder: "160",
385
+ },
386
+ {
387
+ key: "full_screen_button_w",
388
+ label: "Fullscreen button width",
389
+ type: "number_input",
390
+ initial_value: 120,
391
+ placeHolder: "120",
392
+ },
393
+ {
394
+ key: "full_screen_button_h",
395
+ label: "Fullscreen button height",
396
+ type: "number_input",
397
+ initial_value: 120,
398
+ placeHolder: "120",
399
+ },
400
+ {
401
+ key: "full_screen_button_background_color",
402
+ type: "color_picker",
403
+ label: "Fullscreen Button background color",
404
+ initial_value: "#00000000",
405
+ placeHolder: "color",
406
+ label_tooltip: "Pick Color",
407
+ },
408
+ {
409
+ key: "full_screen_button_background_url",
410
+ type: "text_input",
411
+ label: "Fullscreen Button background Url",
412
+ initial_value: "pkg:/images/tv_fullscreen.png",
413
+ placeHolder: "",
414
+ label_tooltip: "",
415
+ },
416
+ {
417
+ key: "full_screen_button_highlighted_background_color",
418
+ type: "color_picker",
419
+ label: "Fullscreen Button highlighted background color",
420
+ initial_value: "#00000000",
421
+ placeHolder: "color",
422
+ label_tooltip: "Pick Color",
423
+ },
424
+ {
425
+ key: "full_screen_button_highlighted_background_url",
426
+ type: "text_input",
427
+ label: "Fullscreen Button highlighted Url",
428
+ initial_value: "pkg:/images/tv_fullscreen.png",
429
+ placeHolder: "",
430
+ label_tooltip: "",
431
+ },
432
+ ]
433
+ ),
354
434
  fieldsGroup(
355
435
  "Skip Button",
356
436
  "This section allows you to configure the skip button styles for tv",
@@ -482,6 +562,20 @@ function getPlayerConfiguration({ platform, version }) {
482
562
  key: "skip_button_style_text_android_font_size",
483
563
  initial_value: 24,
484
564
  },
565
+ {
566
+ type: "roku_font_selector",
567
+ label_tooltip: "",
568
+ label: "Android Font Family",
569
+ key: "skip_button_style_text_roku_font_family",
570
+ initial_value: "Ubuntu-Bold",
571
+ },
572
+ {
573
+ type: "number_input",
574
+ label_tooltip: "",
575
+ label: "Roku Font Size",
576
+ key: "skip_button_style_text_roku_font_size",
577
+ initial_value: 24,
578
+ },
485
579
  {
486
580
  type: "select",
487
581
  options: [
@@ -3330,6 +3424,60 @@ function getPlayerConfiguration({ platform, version }) {
3330
3424
  },
3331
3425
  ]
3332
3426
  ),
3427
+ fieldsGroup(
3428
+ "Roku only",
3429
+ "This section allows you to configure RAF - Roku Ad Framework settings",
3430
+ [
3431
+ {
3432
+ key: "raf_enabled",
3433
+ type: "switch",
3434
+ initial_value: false,
3435
+ },
3436
+ {
3437
+ key: "raf_url",
3438
+ type: "text_input",
3439
+ label: "Ad Url",
3440
+ label_tooltip:
3441
+ "Publisher's ad URL. The default is he roku ad server with single preroll placeholder, with revenue spilt ad sharing by default. TO GET PAID A URL MUST BE PASSED IN HERE. Note: If you are putting ads in child targetted content then your ad url will have to use the ROKU_ADS_KIDS_CONTENT macro value, as per the docs here: developer.roku.com/docs/developer-program/advertising/integrating-roku-advertising-framework.md#url-parameter-macros",
3442
+ },
3443
+ {
3444
+ key: "genre",
3445
+ type: "text_input",
3446
+ label: "Roku Genre",
3447
+ initial_value: "Entertainment",
3448
+ label_tooltip:
3449
+ "Choose value from Roku genre tags, from developer.roku.com/en-gb/docs/developer-program/advertising/integrating-roku-advertising-framework.md",
3450
+ },
3451
+ {
3452
+ key: "nielsen_enabled",
3453
+ type: "checkbox",
3454
+ initial_value: false,
3455
+ label_tooltip:
3456
+ "Required only for apps launched in the US market, See developer.roku.com/en-gb/docs/developer-program/advertising/integrating-roku-advertising-framework.md for details on configuration",
3457
+ },
3458
+ {
3459
+ key: "nielsen_app_id",
3460
+ type: "text_input",
3461
+ initial_value: "",
3462
+ label_tooltip:
3463
+ "id of your app for nielsen leave blank if you don't have a specific id (that is almost always the case)",
3464
+ },
3465
+ {
3466
+ key: "nielsen_genre",
3467
+ type: "text_input",
3468
+ initial_value: "General",
3469
+ label_tooltip:
3470
+ "genre from developer.roku.com/en-gb/docs/developer-program/advertising/integrating-roku-advertising-framework.md#nielsen-dar-genre-tags",
3471
+ },
3472
+ {
3473
+ key: "is_kids_content",
3474
+ type: "checkbox",
3475
+ initial_value: false,
3476
+ label_tooltip:
3477
+ "If your content is directed at kids, this must be checked. See developer.roku.com/docs/developer-program/advertising/raf-api.md#setcontentgenregenres-as-string-kidscontent-as-boolean for more info. Also note your ad urls will have to use the ROKU_ADS_KIDS_CONTENT macro value, as per the docs here: developer.roku.com/docs/developer-program/advertising/integrating-roku-advertising-framework.md#url-parameter-macros",
3478
+ },
3479
+ ]
3480
+ ),
3333
3481
  fieldsGroup(
3334
3482
  "Audio Tracks",
3335
3483
  "This section allows you to configure default audio track behavior for videos with multiple audio tracks",
@@ -485,6 +485,18 @@ const TV_MENU_LABEL_FIELDS = [
485
485
  type: ZAPPIFEST_FIELDS.number_input,
486
486
  suffix: "LG letter spacing",
487
487
  },
488
+ {
489
+ type: ZAPPIFEST_FIELDS.font_selector.roku,
490
+ suffix: "Roku font family",
491
+ },
492
+ {
493
+ type: ZAPPIFEST_FIELDS.number_input,
494
+ suffix: "Roku font size",
495
+ },
496
+ {
497
+ type: ZAPPIFEST_FIELDS.number_input,
498
+ suffix: "Roku line height",
499
+ },
488
500
  {
489
501
  type: ZAPPIFEST_FIELDS.select,
490
502
  suffix: "text transform",
@@ -424,6 +424,12 @@ const titleFields = [
424
424
  key: "vizio_font_family",
425
425
  initial_value: fontFamily,
426
426
  },
427
+ {
428
+ type: "roku_font_selector",
429
+ label: "Roku TV Font Family",
430
+ key: "roku_font_family",
431
+ initial_value: fontFamily,
432
+ },
427
433
  ...generateFontConfiguration(),
428
434
  // text transform
429
435
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "14.0.0-alpha.5533663133",
3
+ "version": "14.0.0-alpha.6242515303",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "14.0.0-alpha.5533663133",
30
+ "@applicaster/applicaster-types": "14.0.0-alpha.6242515303",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -6,7 +6,10 @@ import { NativeModules, Platform } from "react-native";
6
6
  * @param {String} orientation - Orientation enum passed to the function
7
7
  * @returns {Boolean} isTablet - returns whether the given device is a tablet
8
8
  */
9
- export const isTablet = (dimensions, orientation) => {
9
+ export const isTablet = (
10
+ dimensions?: { width: number; height: number },
11
+ orientation?: string
12
+ ) => {
10
13
  if (Platform?.OS === "ios") {
11
14
  return Platform?.isPad;
12
15
  } else if (Platform?.OS === "android") {
@@ -15,7 +18,7 @@ export const isTablet = (dimensions, orientation) => {
15
18
  return initialProps?.is_tablet;
16
19
  }
17
20
 
18
- const { width } = dimensions;
21
+ const { width } = dimensions || {};
19
22
 
20
23
  if (width < 600) return false;
21
24
  if (width >= 600 && width < 840) return orientation === "portrait";