@applicaster/zapp-react-native-utils 16.0.0-rc.59 → 16.0.0-rc.60

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.
@@ -0,0 +1,158 @@
1
+ const { player } = require("../defaultManifestConfigurations/player");
2
+
3
+ const manifestFor = (platform) => player({ platform, version: "0.0.0" });
4
+
5
+ const findGroup = (manifest, label) =>
6
+ manifest.styles.fields.find((group) => group.group && group.label === label);
7
+
8
+ const findFieldInGroup = (manifest, label, key) =>
9
+ findGroup(manifest, label)?.fields?.find((field) => field.key === key);
10
+
11
+ const findLocalization = (manifest, key) =>
12
+ manifest.localizations.fields.find((field) => field.key === key);
13
+
14
+ describe("player manifest — audio playlist controls", () => {
15
+ const manifest = manifestFor("ios_for_quickbrick");
16
+
17
+ describe("Player Controls Layout", () => {
18
+ const field = () =>
19
+ findFieldInGroup(manifest, "Audio Player", "player_controls_layout");
20
+
21
+ it("is declared in the Audio Player group", () => {
22
+ expect(field()).toBeDefined();
23
+ });
24
+
25
+ it("is a select defaulting to the existing controls", () => {
26
+ expect(field().type).toBe("select");
27
+ expect(field().initial_value).toBe("playback_speed_and_sleep_timer");
28
+ });
29
+
30
+ it("only shows when the audio player layout is in use", () => {
31
+ expect(field()).toMatchObject({
32
+ rules: "conditional",
33
+ conditional_fields: [
34
+ { key: "styles/full_screen_audio_player", condition_value: true },
35
+ ],
36
+ });
37
+ });
38
+
39
+ it("offers exactly the two documented options", () => {
40
+ expect(field().options).toEqual([
41
+ {
42
+ text: "Playback Speed & Sleep Timer (Default)",
43
+ value: "playback_speed_and_sleep_timer",
44
+ },
45
+ {
46
+ text: "Playlist Controls (Previous & Next)",
47
+ value: "playlist_controls",
48
+ },
49
+ ]);
50
+ });
51
+ });
52
+
53
+ describe("control icons", () => {
54
+ it.each(["previous_track", "next_track"])(
55
+ "declares %s as an uploader",
56
+ (key) => {
57
+ expect(findFieldInGroup(manifest, "Assets", key)).toMatchObject({
58
+ key,
59
+ type: "uploader",
60
+ });
61
+ }
62
+ );
63
+
64
+ it.each(["previous_track", "next_track"])(
65
+ "only shows %s when the playlist controls layout is selected",
66
+ (key) => {
67
+ expect(findFieldInGroup(manifest, "Assets", key)).toMatchObject({
68
+ rules: "conditional",
69
+ conditional_fields: [
70
+ {
71
+ key: "styles/player_controls_layout",
72
+ condition_value: "playlist_controls",
73
+ },
74
+ ],
75
+ });
76
+ }
77
+ );
78
+
79
+ it.each([
80
+ "speed_0_8",
81
+ "speed_1",
82
+ "speed_1_2",
83
+ "speed_1_5",
84
+ "speed_2",
85
+ "sleep_timer",
86
+ "sleep_timer_active",
87
+ ])(
88
+ "only shows %s when the playback speed and sleep timer layout is selected",
89
+ (key) => {
90
+ expect(findFieldInGroup(manifest, "Assets", key)).toMatchObject({
91
+ rules: "conditional",
92
+ conditional_fields: [
93
+ {
94
+ key: "styles/player_controls_layout",
95
+ condition_value: "playback_speed_and_sleep_timer",
96
+ },
97
+ ],
98
+ });
99
+ }
100
+ );
101
+ });
102
+
103
+ describe("accessibility strings", () => {
104
+ it.each([
105
+ "accessibility_previous_track_label",
106
+ "accessibility_previous_track_hint",
107
+ "accessibility_next_track_label",
108
+ "accessibility_next_track_hint",
109
+ ])("declares %s with a default", (key) => {
110
+ expect(findLocalization(manifest, key)).toMatchObject({
111
+ type: "text_input",
112
+ });
113
+
114
+ expect(findLocalization(manifest, key).initial_value).toBeTruthy();
115
+ });
116
+ });
117
+
118
+ describe("tv platforms", () => {
119
+ // The audio player layout is mobile only, so nothing this feature adds —
120
+ // including its screen reader strings — belongs in a tv manifest.
121
+ it.each(["tvos_for_quickbrick", "android_tv_for_quickbrick", "lg_tv"])(
122
+ "adds no audio controls layout field on %s",
123
+ (platform) => {
124
+ expect(
125
+ findFieldInGroup(
126
+ manifestFor(platform),
127
+ "Audio Player",
128
+ "player_controls_layout"
129
+ )
130
+ ).toBeUndefined();
131
+ }
132
+ );
133
+
134
+ it.each([
135
+ "accessibility_previous_track_label",
136
+ "accessibility_previous_track_hint",
137
+ "accessibility_next_track_label",
138
+ "accessibility_next_track_hint",
139
+ ])("does not declare %s on tv", (key) => {
140
+ expect(
141
+ findLocalization(manifestFor("tvos_for_quickbrick"), key)
142
+ ).toBeUndefined();
143
+ });
144
+
145
+ it("still declares the tv-only localizations", () => {
146
+ expect(
147
+ findLocalization(
148
+ manifestFor("tvos_for_quickbrick"),
149
+ "back_to_live_label"
150
+ )
151
+ ).toBeDefined();
152
+
153
+ expect(
154
+ findLocalization(manifestFor("tvos_for_quickbrick"), "start_over_label")
155
+ ).toBeDefined();
156
+ });
157
+ });
158
+ });
@@ -383,7 +383,45 @@ function getPlayerConfiguration({ platform, version }) {
383
383
  initial_value: "Start Over",
384
384
  type: "text_input",
385
385
  });
386
+ }
387
+
388
+ if (isMobile(platform)) {
389
+ // Screen reader strings for the audio player's playlist controls. Mobile
390
+ // only, because the audio player layout itself is mobile only.
391
+ localizations.fields.push({
392
+ key: "accessibility_previous_track_label",
393
+ label: "Accessibility previous track label",
394
+ initial_value: "Previous track button",
395
+ label_tooltip: "Label for previous track button accessibility",
396
+ type: "text_input",
397
+ });
398
+
399
+ localizations.fields.push({
400
+ key: "accessibility_previous_track_hint",
401
+ label: "Accessibility previous track hint",
402
+ initial_value: "Press to play the previous track",
403
+ label_tooltip: "Hint for previous track button accessibility",
404
+ type: "text_input",
405
+ });
406
+
407
+ localizations.fields.push({
408
+ key: "accessibility_next_track_label",
409
+ label: "Accessibility next track label",
410
+ initial_value: "Next track button",
411
+ label_tooltip: "Label for next track button accessibility",
412
+ type: "text_input",
413
+ });
414
+
415
+ localizations.fields.push({
416
+ key: "accessibility_next_track_hint",
417
+ label: "Accessibility next track hint",
418
+ initial_value: "Press to play the next track",
419
+ label_tooltip: "Hint for next track button accessibility",
420
+ type: "text_input",
421
+ });
422
+ }
386
423
 
424
+ if (isTV(platform)) {
387
425
  styles.fields.push(
388
426
  fieldsGroup("Always Show Scrub Bar & Timestamp", "", [
389
427
  {
@@ -1221,6 +1259,13 @@ function getPlayerConfiguration({ platform, version }) {
1221
1259
  type: "uploader",
1222
1260
  label_tooltip: "Playback Speed 0.8x",
1223
1261
  initial_value: null,
1262
+ rules: "conditional",
1263
+ conditional_fields: [
1264
+ {
1265
+ key: "styles/player_controls_layout",
1266
+ condition_value: "playback_speed_and_sleep_timer",
1267
+ },
1268
+ ],
1224
1269
  },
1225
1270
  {
1226
1271
  key: "speed_1",
@@ -1228,6 +1273,13 @@ function getPlayerConfiguration({ platform, version }) {
1228
1273
  type: "uploader",
1229
1274
  label_tooltip: "Playback Speed 1x",
1230
1275
  initial_value: null,
1276
+ rules: "conditional",
1277
+ conditional_fields: [
1278
+ {
1279
+ key: "styles/player_controls_layout",
1280
+ condition_value: "playback_speed_and_sleep_timer",
1281
+ },
1282
+ ],
1231
1283
  },
1232
1284
  {
1233
1285
  key: "speed_1_2",
@@ -1235,6 +1287,13 @@ function getPlayerConfiguration({ platform, version }) {
1235
1287
  type: "uploader",
1236
1288
  label_tooltip: "Playback Speed 1.2x",
1237
1289
  initial_value: null,
1290
+ rules: "conditional",
1291
+ conditional_fields: [
1292
+ {
1293
+ key: "styles/player_controls_layout",
1294
+ condition_value: "playback_speed_and_sleep_timer",
1295
+ },
1296
+ ],
1238
1297
  },
1239
1298
  {
1240
1299
  key: "speed_1_5",
@@ -1242,6 +1301,13 @@ function getPlayerConfiguration({ platform, version }) {
1242
1301
  type: "uploader",
1243
1302
  label_tooltip: "Playback Speed 1.5x",
1244
1303
  initial_value: null,
1304
+ rules: "conditional",
1305
+ conditional_fields: [
1306
+ {
1307
+ key: "styles/player_controls_layout",
1308
+ condition_value: "playback_speed_and_sleep_timer",
1309
+ },
1310
+ ],
1245
1311
  },
1246
1312
  {
1247
1313
  key: "speed_2",
@@ -1249,6 +1315,13 @@ function getPlayerConfiguration({ platform, version }) {
1249
1315
  type: "uploader",
1250
1316
  label_tooltip: "Playback Speed 2x",
1251
1317
  initial_value: null,
1318
+ rules: "conditional",
1319
+ conditional_fields: [
1320
+ {
1321
+ key: "styles/player_controls_layout",
1322
+ condition_value: "playback_speed_and_sleep_timer",
1323
+ },
1324
+ ],
1252
1325
  },
1253
1326
  {
1254
1327
  key: "sleep_timer",
@@ -1256,6 +1329,13 @@ function getPlayerConfiguration({ platform, version }) {
1256
1329
  type: "uploader",
1257
1330
  label_tooltip: "Sleep Timer Default",
1258
1331
  initial_value: null,
1332
+ rules: "conditional",
1333
+ conditional_fields: [
1334
+ {
1335
+ key: "styles/player_controls_layout",
1336
+ condition_value: "playback_speed_and_sleep_timer",
1337
+ },
1338
+ ],
1259
1339
  },
1260
1340
  {
1261
1341
  key: "sleep_timer_active",
@@ -1263,6 +1343,43 @@ function getPlayerConfiguration({ platform, version }) {
1263
1343
  type: "uploader",
1264
1344
  label_tooltip: "Sleep Timer Active",
1265
1345
  initial_value: null,
1346
+ rules: "conditional",
1347
+ conditional_fields: [
1348
+ {
1349
+ key: "styles/player_controls_layout",
1350
+ condition_value: "playback_speed_and_sleep_timer",
1351
+ },
1352
+ ],
1353
+ },
1354
+ {
1355
+ key: "previous_track",
1356
+ label: "Previous Track Control Icon",
1357
+ type: "uploader",
1358
+ label_tooltip:
1359
+ "Override the default Previous Track icon. Recommended size 120x120px (@3x).",
1360
+ initial_value: null,
1361
+ rules: "conditional",
1362
+ conditional_fields: [
1363
+ {
1364
+ key: "styles/player_controls_layout",
1365
+ condition_value: "playlist_controls",
1366
+ },
1367
+ ],
1368
+ },
1369
+ {
1370
+ key: "next_track",
1371
+ label: "Next Track Control Icon",
1372
+ type: "uploader",
1373
+ label_tooltip:
1374
+ "Override the default Next Track icon. Recommended size 120x120px (@3x).",
1375
+ initial_value: null,
1376
+ rules: "conditional",
1377
+ conditional_fields: [
1378
+ {
1379
+ key: "styles/player_controls_layout",
1380
+ condition_value: "playlist_controls",
1381
+ },
1382
+ ],
1266
1383
  },
1267
1384
  ]
1268
1385
  ),
@@ -1279,6 +1396,35 @@ function getPlayerConfiguration({ platform, version }) {
1279
1396
  type: "switch",
1280
1397
  label_tooltip: "Select whether you want to display title in player",
1281
1398
  },
1399
+ {
1400
+ section: "title",
1401
+ key: "title_data_key_source",
1402
+ label: "Title data key",
1403
+ initial_value: "title",
1404
+ type: "select",
1405
+ options: [
1406
+ { text: "Title", value: "title" },
1407
+ { text: "Other", value: "other" },
1408
+ ],
1409
+ label_tooltip:
1410
+ "Select which feed data key provides the player content title. Keep 'Title' to use the entry title",
1411
+ },
1412
+ {
1413
+ section: "title",
1414
+ key: "title_custom_data_key",
1415
+ label: "Custom title data key",
1416
+ initial_value: "",
1417
+ type: "text_input",
1418
+ rules: "conditional",
1419
+ conditional_fields: [
1420
+ {
1421
+ key: "styles/title_data_key_source",
1422
+ condition_value: "other",
1423
+ },
1424
+ ],
1425
+ label_tooltip:
1426
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_name. Falls back to the entry title if the key is empty or missing",
1427
+ },
1282
1428
  {
1283
1429
  section: "title",
1284
1430
  key: "title_font_android",
@@ -1686,6 +1832,35 @@ function getPlayerConfiguration({ platform, version }) {
1686
1832
  label_tooltip:
1687
1833
  "Select whether you want to display subtitle in player",
1688
1834
  },
1835
+ {
1836
+ section: "subtitle",
1837
+ key: "subtitle_data_key_source",
1838
+ label: "Subtitle data key",
1839
+ initial_value: "summary",
1840
+ type: "select",
1841
+ options: [
1842
+ { text: "Subtitle", value: "summary" },
1843
+ { text: "Other", value: "other" },
1844
+ ],
1845
+ label_tooltip:
1846
+ "Select which feed data key provides the player content subtitle. Keep 'Subtitle' to use the entry summary",
1847
+ },
1848
+ {
1849
+ section: "subtitle",
1850
+ key: "subtitle_custom_data_key",
1851
+ label: "Custom subtitle data key",
1852
+ initial_value: "",
1853
+ type: "text_input",
1854
+ rules: "conditional",
1855
+ conditional_fields: [
1856
+ {
1857
+ key: "styles/subtitle_data_key_source",
1858
+ condition_value: "other",
1859
+ },
1860
+ ],
1861
+ label_tooltip:
1862
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_subtitle. Falls back to the entry summary if the key is empty or missing",
1863
+ },
1689
1864
  {
1690
1865
  section: "subtitle",
1691
1866
  key: "subtitle_font_android",
@@ -2850,6 +3025,33 @@ function getPlayerConfiguration({ platform, version }) {
2850
3025
  "Video Player - Title Text",
2851
3026
  "Video Player Title Text Label Styles",
2852
3027
  [
3028
+ {
3029
+ key: "video_player_title_data_key_source",
3030
+ label: "Video title data key",
3031
+ initial_value: "title",
3032
+ type: "select",
3033
+ options: [
3034
+ { text: "Title", value: "title" },
3035
+ { text: "Other", value: "other" },
3036
+ ],
3037
+ label_tooltip:
3038
+ "Select which feed data key provides the video player title. Keep 'Title' to use the entry title",
3039
+ },
3040
+ {
3041
+ key: "video_player_title_custom_data_key",
3042
+ label: "Custom video title data key",
3043
+ initial_value: "",
3044
+ type: "text_input",
3045
+ rules: "conditional",
3046
+ conditional_fields: [
3047
+ {
3048
+ key: "styles/video_player_title_data_key_source",
3049
+ condition_value: "other",
3050
+ },
3051
+ ],
3052
+ label_tooltip:
3053
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_name. Falls back to the entry title if the key is empty or missing",
3054
+ },
2853
3055
  {
2854
3056
  key: "player_title_color",
2855
3057
  label: "Font color",
@@ -2935,6 +3137,33 @@ function getPlayerConfiguration({ platform, version }) {
2935
3137
  "Video Player - Summary Text",
2936
3138
  "Video Player Summary Text Label Styles",
2937
3139
  [
3140
+ {
3141
+ key: "video_player_summary_data_key_source",
3142
+ label: "Video summary data key",
3143
+ initial_value: "summary",
3144
+ type: "select",
3145
+ options: [
3146
+ { text: "Summary", value: "summary" },
3147
+ { text: "Other", value: "other" },
3148
+ ],
3149
+ label_tooltip:
3150
+ "Select which feed data key provides the video player summary. Keep 'Summary' to use the entry summary",
3151
+ },
3152
+ {
3153
+ key: "video_player_summary_custom_data_key",
3154
+ label: "Custom video summary data key",
3155
+ initial_value: "",
3156
+ type: "text_input",
3157
+ rules: "conditional",
3158
+ conditional_fields: [
3159
+ {
3160
+ key: "styles/video_player_summary_data_key_source",
3161
+ condition_value: "other",
3162
+ },
3163
+ ],
3164
+ label_tooltip:
3165
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_subtitle. Falls back to the entry summary if the key is empty or missing",
3166
+ },
2938
3167
  {
2939
3168
  key: "player_summary_color",
2940
3169
  label: "Font color",
@@ -3020,6 +3249,33 @@ function getPlayerConfiguration({ platform, version }) {
3020
3249
  "Audio Player - Title Text",
3021
3250
  "Audio Player Title Text Label Styles",
3022
3251
  [
3252
+ {
3253
+ key: "audio_player_title_data_key_source",
3254
+ label: "Audio title data key",
3255
+ initial_value: "title",
3256
+ type: "select",
3257
+ options: [
3258
+ { text: "Title", value: "title" },
3259
+ { text: "Other", value: "other" },
3260
+ ],
3261
+ label_tooltip:
3262
+ "Select which feed data key provides the audio player title. Keep 'Title' to use the entry title",
3263
+ },
3264
+ {
3265
+ key: "audio_player_title_custom_data_key",
3266
+ label: "Custom audio title data key",
3267
+ initial_value: "",
3268
+ type: "text_input",
3269
+ rules: "conditional",
3270
+ conditional_fields: [
3271
+ {
3272
+ key: "styles/audio_player_title_data_key_source",
3273
+ condition_value: "other",
3274
+ },
3275
+ ],
3276
+ label_tooltip:
3277
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_name. Falls back to the entry title if the key is empty or missing",
3278
+ },
3023
3279
  {
3024
3280
  key: "audio_player_title_color",
3025
3281
  label: "Audio player title color",
@@ -3105,6 +3361,33 @@ function getPlayerConfiguration({ platform, version }) {
3105
3361
  "Audio Player - Summary Text",
3106
3362
  "Audio Player Summary Text Label Styles",
3107
3363
  [
3364
+ {
3365
+ key: "audio_player_summary_data_key_source",
3366
+ label: "Audio summary data key",
3367
+ initial_value: "summary",
3368
+ type: "select",
3369
+ options: [
3370
+ { text: "Summary", value: "summary" },
3371
+ { text: "Other", value: "other" },
3372
+ ],
3373
+ label_tooltip:
3374
+ "Select which feed data key provides the audio player summary. Keep 'Summary' to use the entry summary",
3375
+ },
3376
+ {
3377
+ key: "audio_player_summary_custom_data_key",
3378
+ label: "Custom audio summary data key",
3379
+ initial_value: "",
3380
+ type: "text_input",
3381
+ rules: "conditional",
3382
+ conditional_fields: [
3383
+ {
3384
+ key: "styles/audio_player_summary_data_key_source",
3385
+ condition_value: "other",
3386
+ },
3387
+ ],
3388
+ label_tooltip:
3389
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_subtitle. Falls back to the entry summary if the key is empty or missing",
3390
+ },
3108
3391
  {
3109
3392
  key: "audio_player_summary_color",
3110
3393
  label: "Audio player summary color",
@@ -3451,6 +3734,31 @@ function getPlayerConfiguration({ platform, version }) {
3451
3734
  },
3452
3735
  ],
3453
3736
  },
3737
+ {
3738
+ key: "player_controls_layout",
3739
+ label: "Player Controls Layout",
3740
+ type: "select",
3741
+ initial_value: "playback_speed_and_sleep_timer",
3742
+ label_tooltip:
3743
+ "Choose which secondary controls appear in the audio player transport row.",
3744
+ rules: "conditional",
3745
+ conditional_fields: [
3746
+ {
3747
+ key: "styles/full_screen_audio_player",
3748
+ condition_value: true,
3749
+ },
3750
+ ],
3751
+ options: [
3752
+ {
3753
+ text: "Playback Speed & Sleep Timer (Default)",
3754
+ value: "playback_speed_and_sleep_timer",
3755
+ },
3756
+ {
3757
+ text: "Playlist Controls (Previous & Next)",
3758
+ value: "playlist_controls",
3759
+ },
3760
+ ],
3761
+ },
3454
3762
  {
3455
3763
  key: "audio_player_artwork_shadow_enabled",
3456
3764
  label: "Image Shadow Enabled",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "16.0.0-rc.59",
3
+ "version": "16.0.0-rc.60",
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": "16.0.0-rc.59",
30
+ "@applicaster/applicaster-types": "16.0.0-rc.60",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",