@tantawowa/hosanna-ui 2.4.1 → 2.5.1

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.
@@ -2,8 +2,8 @@
2
2
  "schemaVersion": 2,
3
3
  "artifact": "npm-sdk",
4
4
  "packageName": "@tantawowa/hosanna-ui",
5
- "version": "2.4.1",
6
- "sourceCommit": "0af275e64508b64eab71ec768177a7d7a08d3bce",
5
+ "version": "2.5.1",
6
+ "sourceCommit": "46aca83d866fd94b0a95095c0b1a16bd7307a290",
7
7
  "files": [
8
8
  {
9
9
  "path": "LICENSE",
@@ -279,7 +279,7 @@
279
279
  },
280
280
  {
281
281
  "path": "src/hosanna-bridge-targets/roku/RokuMainLoopRunner.ts",
282
- "sha256": "b577b55c1d2ec91455458a133fb261a98335e4ac6ef66023d57b70a8dadd1a3b"
282
+ "sha256": "4428eb64bcc31f6d3c35e8b6938592556b3a8e503c8bb664c59cbb61e76dd9d8"
283
283
  },
284
284
  {
285
285
  "path": "src/hosanna-bridge-targets/roku/RokuMainLoopUtil.ts",
@@ -899,7 +899,7 @@
899
899
  },
900
900
  {
901
901
  "path": "src/hosanna-bridge-targets/web/sg/WebSGScene.ts",
902
- "sha256": "4cd8818ee83a0907bc48a678d03a1c94661c523b8aebb0aff01421ce1979ccf2"
902
+ "sha256": "00e3974e3afc8c16895b48f1c7f2779a609670d5022cdb055699a0a8e1957f70"
903
903
  },
904
904
  {
905
905
  "path": "src/hosanna-bridge-targets/web/sg/WebSGSimpleLabel.ts",
@@ -1675,7 +1675,7 @@
1675
1675
  },
1676
1676
  {
1677
1677
  "path": "src/hosanna-list/CollectionViewAPI.ts",
1678
- "sha256": "c34f3d79ed44801d1c3bcb1c27d85359d5e319f7054c08377f1080fd8c89ef63"
1678
+ "sha256": "678448bfa98ec212293e973a685315f18a9be9933a4c502e9b24ed0e674432ed"
1679
1679
  },
1680
1680
  {
1681
1681
  "path": "src/hosanna-list/CollectionViewDSLManager.ts",
@@ -1707,7 +1707,7 @@
1707
1707
  },
1708
1708
  {
1709
1709
  "path": "src/hosanna-list/CollectionViewFocusManager.ts",
1710
- "sha256": "29f99fc2b97322fecb0711eb50349494f52b2e55417e9a5d2af7669cbf3f1157"
1710
+ "sha256": "eeeead7bdb73e2f2487caf0adcc3d13e212bfe6359cedb9321d35a121ba83021"
1711
1711
  },
1712
1712
  {
1713
1713
  "path": "src/hosanna-list/CollectionViewInteractions.ts",
@@ -1939,7 +1939,7 @@
1939
1939
  },
1940
1940
  {
1941
1941
  "path": "src/hosanna-ui/hosanna-api.ts",
1942
- "sha256": "271c43ab60c3310bb72542c5b4e6fd97fad7a81fed01255dc36cdf0c93b1d297"
1942
+ "sha256": "a22ac8d08a2a299a931b8627f14ceb25fbabb77f6132ea99b820feb3049c99fb"
1943
1943
  },
1944
1944
  {
1945
1945
  "path": "src/hosanna-ui/lib/AppConfigAssetBundles.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tantawowa/hosanna-ui",
3
- "version": "2.4.1",
3
+ "version": "2.5.1",
4
4
  "description": "Hosanna UI source SDK for Roku and its browser emulator",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -165,7 +165,7 @@ export class RokuMainLoopRunner {
165
165
 
166
166
  m.reportChannelMemoryStats()
167
167
 
168
- return {
168
+ m.mainLoopContext = {
169
169
  screen: screen,
170
170
  scene: scene,
171
171
  port: port,
@@ -174,6 +174,7 @@ export class RokuMainLoopRunner {
174
174
  deviceInfo: deviceInfo,
175
175
  memoryMonitor: memoryMonitor
176
176
  }
177
+ return m.mainLoopContext
177
178
  `);
178
179
  return undefined;
179
180
  }
@@ -246,6 +247,8 @@ export class RokuMainLoopRunner {
246
247
 
247
248
  if command.command = "ExitApp"
248
249
  return true
250
+ else if command.command = "RefreshAudioGuide"
251
+ m.refreshAudioGuide()
249
252
  else
250
253
  print "Unknown command: " + command.command
251
254
  end if
@@ -255,6 +258,31 @@ export class RokuMainLoopRunner {
255
258
  return false;
256
259
  }
257
260
 
261
+ private refreshAudioGuide(): void {
262
+ hs_native_roku(`
263
+ context = m.mainLoopContext
264
+ if context = invalid then return invalid
265
+
266
+ enabled = context.deviceInfo.IsAudioGuideEnabled()
267
+ if enabled
268
+ m.rebindTextToSpeechEvents(context)
269
+ end if
270
+
271
+ ' Sync the screen reader only after the new listener can receive completions.
272
+ m.dispatchSystemEvent(context.scene, {
273
+ type: "roDeviceInfoEvent",
274
+ data: { audioGuideEnabled: enabled }
275
+ })
276
+ `);
277
+ }
278
+
279
+ private rebindTextToSpeechEvents(context: RokuMainLoopContext): void {
280
+ hs_native_roku(`
281
+ context.textToSpeech = CreateObject("roTextToSpeech")
282
+ context.textToSpeech.SetMessagePort(context.port)
283
+ `);
284
+ }
285
+
258
286
  protected handleInputEvent(msg: object, scene: object): void {
259
287
  hs_native_roku(`
260
288
  info = msg.getInfo()
@@ -310,6 +338,12 @@ export class RokuMainLoopRunner {
310
338
  return invalid
311
339
  end if
312
340
 
341
+ context = m.mainLoopContext
342
+ if context <> invalid and info.audioGuideEnabled = true
343
+ ' Roku may stop sending speech completion events when Audio Guide is enabled after launch.
344
+ m.rebindTextToSpeechEvents(context)
345
+ end if
346
+
313
347
  data = {}
314
348
 
315
349
  for each key in info
@@ -274,8 +274,11 @@ export class WebSGScene extends WebSGGroup implements ISGNScene {
274
274
 
275
275
  set dialog(value: ISGNStandardDialog | undefined) {
276
276
  if (value) {
277
- this.dialogHolder.appendChild(value);
278
277
  this.dialogGroup.visible = true;
278
+ if (this.dialogGroup instanceof WebSGGroup) {
279
+ this.dialogGroup.render();
280
+ }
281
+ this.dialogHolder.appendChild(value);
279
282
  value.observeFieldScoped('close', this.onDialogClose.bind(this, value));
280
283
  }
281
284
  this._dialog = value;
@@ -290,6 +293,9 @@ export class WebSGScene extends WebSGGroup implements ISGNScene {
290
293
  this.dialogHolder.removeChild(dialog);
291
294
  if (this.dialogHolder.getChildCount() === 0) {
292
295
  this.dialogGroup.visible = false;
296
+ if (this.dialogGroup instanceof WebSGGroup) {
297
+ this.dialogGroup.render();
298
+ }
293
299
  }
294
300
  }
295
301
  }
@@ -907,6 +907,8 @@ export interface ICollectionViewDataSourceItemFocusSettings {
907
907
  }
908
908
 
909
909
  export interface ICollectionViewDataSourceItem extends IIdentifiable, ICollectionViewDataSourceItemFocusSettings {
910
+ /** Spoken card label. If omitted or blank, Audio Guide uses the item's title. */
911
+ audioGuideLabel?: string;
910
912
  /** Internal content revision advanced by CollectionViewDataSource.updateItem(). */
911
913
  __hsVersion?: number;
912
914
  /** Optional per-item style key used when the row has `useMixedCellStyleKeys` enabled. */
@@ -491,15 +491,12 @@ export class CollectionViewFocusManager implements ICollectionViewFocusManager,
491
491
  if (!focusedRow) {
492
492
  return;
493
493
  }
494
- const item = this.collectionView.getFocusedDataSourceItem();
495
494
  const currentRowIndex = this.focusInfo.rowIndex;
496
495
  const currentItemIndex = this.focusInfo.itemIndex;
497
496
 
498
497
  const isNewRow = force || currentRowIndex !== this.lastSpokenRowIndex;
499
498
  const isNewItem = force || currentItemIndex !== this.lastSpokenItemIndex || isNewRow;
500
499
 
501
-
502
- let text = isNewItem ? `${(item as JsonData)?.title ?? ''} Item ${currentItemIndex + 1} of ${focusedRow?.content?.items?.length ?? 0}.` : '';
503
500
  this.lastSpokenRowIndex = currentRowIndex;
504
501
  this.lastSpokenItemIndex = currentItemIndex;
505
502
 
@@ -508,6 +505,16 @@ export class CollectionViewFocusManager implements ICollectionViewFocusManager,
508
505
  return;
509
506
  }
510
507
 
508
+ let text = '';
509
+ if (isNewItem) {
510
+ const item = this.collectionView.getFocusedDataSourceItem() as JsonData | undefined;
511
+ const audioGuideLabel = item?.audioGuideLabel;
512
+ const label = typeof audioGuideLabel === 'string' && audioGuideLabel.trim()
513
+ ? audioGuideLabel
514
+ : item?.title ?? '';
515
+ text = `${label} Item ${currentItemIndex + 1} of ${focusedRow.content?.items?.length ?? 0}.`;
516
+ }
517
+
511
518
  // Speak row label if it's a new row
512
519
  if (isNewRow) {
513
520
  const totalRows = this.collectionView.getRows().length;
@@ -64,6 +64,7 @@ export enum Color {
64
64
  export enum HsMainCommandType {
65
65
  None = 'None',
66
66
  ExitApp = 'ExitApp',
67
+ RefreshAudioGuide = 'RefreshAudioGuide',
67
68
  }
68
69
 
69
70
  export interface IHosannaMainCommand {