mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +00:00
Voice: an app can supply what open_stories does
createApplicationTools took the Stories page as the open_stories action even when the app's voice options gave its own. voice.openStories now takes precedence, spoken or typed, with the Stories page as the default.
This commit is contained in:
1 parent
fa6d954702
commit
b1b2ac91c0
4 files changed
+76
-9
No files matched your search
@@ -12,6 +12,23 @@ export function stopVoiceForStories(session) {
|
||||
return wasActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* What the `open_stories` action does, spoken or typed: the app's own
|
||||
* `openStories` when it supplies one, else open the Stories page (none
|
||||
* where Stories is not offered). It is called with `{ isCurrent }` and
|
||||
* answers true when it opened, 'already-open', or false.
|
||||
* @param {{openStories?: Function|null,
|
||||
* store: {available: boolean, mode: string},
|
||||
* stories: {open: (options: {isCurrent: () => boolean}) => unknown}}} options
|
||||
* @returns {Function|null}
|
||||
*/
|
||||
export function storiesOpener({ openStories, store, stories }) {
|
||||
if (typeof openStories === 'function') return openStories;
|
||||
if (!store.available) return null;
|
||||
return ({ isCurrent }) =>
|
||||
store.mode === 'closed' ? stories.open({ isCurrent }) : 'already-open';
|
||||
}
|
||||
|
||||
/**
|
||||
* Stories, loaded on first use. The controller, the story catalog, the
|
||||
* screens and their styles are separate chunks, fetched when the person
|
||||
|
||||
Reference in new issue
Block a user