@tantawowa/hosanna-ui 2.4.0 → 2.5.0
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.
- package/dist-manifest.json +8 -8
- package/package.json +1 -1
- package/src/hosanna-bridge-targets/roku/RokuMainLoopRunner.ts +35 -1
- package/src/hosanna-list/CollectionViewAPI.ts +2 -0
- package/src/hosanna-list/CollectionViewDataSource.ts +2 -2
- package/src/hosanna-list/CollectionViewFocusManager.ts +10 -3
- package/src/hosanna-ui/hosanna-api.ts +1 -0
- package/src/hosanna-ui/targets/web/app/WebAsyncManagerTask.ts +9 -5
package/dist-manifest.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"artifact": "npm-sdk",
|
|
4
4
|
"packageName": "@tantawowa/hosanna-ui",
|
|
5
|
-
"version": "2.
|
|
6
|
-
"sourceCommit": "
|
|
5
|
+
"version": "2.5.0",
|
|
6
|
+
"sourceCommit": "a4c61b08121c0628d52ff2196a10eaf3b84a8dda",
|
|
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": "
|
|
282
|
+
"sha256": "4428eb64bcc31f6d3c35e8b6938592556b3a8e503c8bb664c59cbb61e76dd9d8"
|
|
283
283
|
},
|
|
284
284
|
{
|
|
285
285
|
"path": "src/hosanna-bridge-targets/roku/RokuMainLoopUtil.ts",
|
|
@@ -1675,7 +1675,7 @@
|
|
|
1675
1675
|
},
|
|
1676
1676
|
{
|
|
1677
1677
|
"path": "src/hosanna-list/CollectionViewAPI.ts",
|
|
1678
|
-
"sha256": "
|
|
1678
|
+
"sha256": "678448bfa98ec212293e973a685315f18a9be9933a4c502e9b24ed0e674432ed"
|
|
1679
1679
|
},
|
|
1680
1680
|
{
|
|
1681
1681
|
"path": "src/hosanna-list/CollectionViewDSLManager.ts",
|
|
@@ -1691,7 +1691,7 @@
|
|
|
1691
1691
|
},
|
|
1692
1692
|
{
|
|
1693
1693
|
"path": "src/hosanna-list/CollectionViewDataSource.ts",
|
|
1694
|
-
"sha256": "
|
|
1694
|
+
"sha256": "f61f5e205ca826dbb9651b9b658a1a5159b32b8f9e906d97800787be77b9790c"
|
|
1695
1695
|
},
|
|
1696
1696
|
{
|
|
1697
1697
|
"path": "src/hosanna-list/CollectionViewDataSourceUtils.ts",
|
|
@@ -1707,7 +1707,7 @@
|
|
|
1707
1707
|
},
|
|
1708
1708
|
{
|
|
1709
1709
|
"path": "src/hosanna-list/CollectionViewFocusManager.ts",
|
|
1710
|
-
"sha256": "
|
|
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": "
|
|
1942
|
+
"sha256": "a22ac8d08a2a299a931b8627f14ceb25fbabb77f6132ea99b820feb3049c99fb"
|
|
1943
1943
|
},
|
|
1944
1944
|
{
|
|
1945
1945
|
"path": "src/hosanna-ui/lib/AppConfigAssetBundles.ts",
|
|
@@ -2451,7 +2451,7 @@
|
|
|
2451
2451
|
},
|
|
2452
2452
|
{
|
|
2453
2453
|
"path": "src/hosanna-ui/targets/web/app/WebAsyncManagerTask.ts",
|
|
2454
|
-
"sha256": "
|
|
2454
|
+
"sha256": "c1a60cfa5cbca5339c2c0cfd3333812f6125a9e8a8d0b819856c70268dbe98d4"
|
|
2455
2455
|
},
|
|
2456
2456
|
{
|
|
2457
2457
|
"path": "src/hosanna-ui/targets/web/app/web-input-adapter-profile.ts",
|
package/package.json
CHANGED
|
@@ -165,7 +165,7 @@ export class RokuMainLoopRunner {
|
|
|
165
165
|
|
|
166
166
|
m.reportChannelMemoryStats()
|
|
167
167
|
|
|
168
|
-
|
|
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
|
|
@@ -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. */
|
|
@@ -415,10 +415,10 @@ export class CollectionViewDataSource {
|
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
private resolveItemInsertIndex(index: number | 'end' | 'end-1' | 'end-2' | 'end - 1' | 'end - 2', length: number): number {
|
|
418
|
+
if (typeof index === 'number') return Math.max(0, Math.min(index, length));
|
|
418
419
|
if (index === 'end') return length;
|
|
419
420
|
if (index === 'end-1' || index === 'end - 1') return Math.max(0, length - 1);
|
|
420
|
-
|
|
421
|
-
return Math.max(0, Math.min(index, length));
|
|
421
|
+
return Math.max(0, length - 2);
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
|
|
@@ -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;
|
|
@@ -6,7 +6,12 @@ import {
|
|
|
6
6
|
IAsyncCommand,
|
|
7
7
|
IAsyncEvent,
|
|
8
8
|
} from '@hs-src/hosanna-ui/async/AsyncApi';
|
|
9
|
-
import { createWebTaskGlobalAA, runWithGlobalAA } from '@hs-src/hosanna-bridge-targets/web/sg/sg-global-functions-web';
|
|
9
|
+
import type { createWebTaskGlobalAA, runWithGlobalAA } from '@hs-src/hosanna-bridge-targets/web/sg/sg-global-functions-web';
|
|
10
|
+
|
|
11
|
+
const webGlobals = globalThis as typeof globalThis & {
|
|
12
|
+
hs_createWebTaskGlobalAA: typeof createWebTaskGlobalAA;
|
|
13
|
+
hs_runWithGlobalAA: typeof runWithGlobalAA;
|
|
14
|
+
};
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* WebAsyncManagerTask is a specialized SGTask for managing async commands and events on the web platform.
|
|
@@ -64,9 +69,8 @@ export class WebAsyncManagerTask extends WebSGTask {
|
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
const appAA = GetGlobalAA();
|
|
67
|
-
|
|
68
|
-
this.
|
|
69
|
-
runWithGlobalAA(taskAA, () => {
|
|
72
|
+
this.taskAA = webGlobals.hs_createWebTaskGlobalAA(this.id || 'unknown', appAA, this);
|
|
73
|
+
this.runTaskScoped(() => {
|
|
70
74
|
configureHosannaForAsyncTask(this);
|
|
71
75
|
const asyncManager = new AsyncManager(this);
|
|
72
76
|
if (typeof asyncManager.runWebLoop === 'function') {
|
|
@@ -82,7 +86,7 @@ export class WebAsyncManagerTask extends WebSGTask {
|
|
|
82
86
|
|
|
83
87
|
runTaskScoped<T>(callback: () => T): T {
|
|
84
88
|
if (this.taskAA) {
|
|
85
|
-
return
|
|
89
|
+
return webGlobals.hs_runWithGlobalAA(this.taskAA, callback);
|
|
86
90
|
}
|
|
87
91
|
return callback();
|
|
88
92
|
}
|