mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 02:01:40 +00:00
FIX - boot LB custom app frames
This commit is contained in:
@@ -17,6 +17,7 @@ import type {
|
||||
} from '@/types/apps'
|
||||
import {
|
||||
createCustomAppBridgeRequestHandler,
|
||||
getCustomAppFrameBootstrapMessages,
|
||||
getSkyPhoneAppCapabilities,
|
||||
shouldReportCustomAppReady,
|
||||
} from '@/utils/customAppBridge'
|
||||
@@ -266,6 +267,11 @@ function onFrameLoad(): void {
|
||||
loadTimeout = undefined
|
||||
}
|
||||
frameLoaded.value = true
|
||||
for (const message of getCustomAppFrameBootstrapMessages(
|
||||
props.app.compatibility,
|
||||
)) {
|
||||
postToFrame(message)
|
||||
}
|
||||
if (props.app.bridgeMode === 'legacy' || skyBridgeReady.value) {
|
||||
frameUnavailable.value = false
|
||||
}
|
||||
@@ -331,7 +337,6 @@ watch(() => catalog.openRequests[props.app.id], flushOpenRequest, {
|
||||
:class="{
|
||||
'custom-app-frame--fix-blur': app.compatibility.fixBlur === true,
|
||||
}"
|
||||
:name="app.ownerResource"
|
||||
:sandbox="sandbox"
|
||||
:src="frameUrl"
|
||||
:title="app.name"
|
||||
|
||||
@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import {
|
||||
createCustomAppBridgeRequestHandler,
|
||||
getCustomAppFrameBootstrapMessages,
|
||||
getSkyPhoneAppCapabilities,
|
||||
shouldReportCustomAppReady,
|
||||
type CustomAppBridgeNotification,
|
||||
@@ -60,6 +61,15 @@ describe('custom app bridge', () => {
|
||||
expect(shouldReportCustomAppReady('sky', 'bridge-ready')).toBe(true)
|
||||
})
|
||||
|
||||
it('boots LB Phone frames with their documented ready signal', () => {
|
||||
expect(
|
||||
getCustomAppFrameBootstrapMessages({ provider: 'lb_phone' }),
|
||||
).toEqual(['componentsLoaded'])
|
||||
expect(
|
||||
getCustomAppFrameBootstrapMessages({ provider: '17mov' }),
|
||||
).toEqual([])
|
||||
})
|
||||
|
||||
it('passes validated storage data and server response data through', async () => {
|
||||
source.capabilities = ['device.storage']
|
||||
storageCall.mockResolvedValue({
|
||||
|
||||
@@ -294,6 +294,15 @@ export function shouldReportCustomAppReady(
|
||||
: signal === 'frame-load'
|
||||
}
|
||||
|
||||
export function getCustomAppFrameBootstrapMessages(
|
||||
compatibility: Readonly<Record<string, unknown>>,
|
||||
): readonly unknown[] {
|
||||
if (compatibility.provider === 'lb_phone') {
|
||||
return ['componentsLoaded']
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
export function createCustomAppBridgeRequestHandler(
|
||||
dependencies: CustomAppBridgeDependencies,
|
||||
): {
|
||||
|
||||
Reference in New Issue
Block a user