fix(web): open artifacts outside the installed app context
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
// node with these functions; server-derived text is always assigned through
|
||||
// textContent, never innerHTML.
|
||||
|
||||
import { artifactBrowserLinkProps } from "./artifactNavigation.js";
|
||||
export { artifactBrowserLinkProps } from "./artifactNavigation.js";
|
||||
|
||||
export function h(tag, props = {}, ...children) {
|
||||
const node = document.createElement(tag);
|
||||
for (const [key, value] of Object.entries(props)) {
|
||||
@@ -19,6 +22,18 @@ export function h(tag, props = {}, ...children) {
|
||||
return node;
|
||||
}
|
||||
|
||||
/** Run synchronously inside a click/keyboard gesture: Android rejects intents
|
||||
* launched from timers. Never fall back to replacing the app's own location. */
|
||||
export function openArtifactInBrowser(resolved) {
|
||||
const props = artifactBrowserLinkProps(resolved);
|
||||
if (!props) return false;
|
||||
const link = h("a", { ...props, hidden: true });
|
||||
document.body.append(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
return true; // A hand-off was requested; the OS decides which browser handles it.
|
||||
}
|
||||
|
||||
/** One small live-stream badge (LiveBadge.kt): a dot plus the honest word. */
|
||||
export function renderLiveBadge(info) {
|
||||
return h(
|
||||
|
||||
Reference in New Issue
Block a user