接入热身入口原生导航
儿童动作热身入口在原生壳内优先走受控导航 新增 HostBridge 真实导航请求测试 同步宿主壳协议文档和共享记忆
This commit is contained in:
@@ -316,6 +316,7 @@ import {
|
||||
recordRpgEntryWorldGalleryPlay,
|
||||
remixRpgEntryWorldGallery,
|
||||
} from '../../services/rpg-entry/rpgEntryLibraryClient';
|
||||
import { navigateHostNativePage } from '../../services/host-bridge/hostBridge';
|
||||
import {
|
||||
getRpgProfilePlayStats,
|
||||
submitRpgProfileFeedback,
|
||||
@@ -7087,7 +7088,12 @@ export function PlatformEntryFlowShellImpl({
|
||||
}, [setSelectionStage]);
|
||||
|
||||
const startChildMotionDemo = useCallback(() => {
|
||||
window.location.assign('/child-motion-demo');
|
||||
void (async () => {
|
||||
const navigated = await navigateHostNativePage('/child-motion-demo');
|
||||
if (!navigated) {
|
||||
window.location.assign('/child-motion-demo');
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
|
||||
const resolveBabyObjectMatchRuntimeDraft = useCallback(
|
||||
|
||||
@@ -9248,6 +9248,33 @@ test('native app jump hop draft completion sends host notification and badge fro
|
||||
});
|
||||
});
|
||||
|
||||
test('native app opens child motion demo through host navigation bridge', async () => {
|
||||
const user = userEvent.setup();
|
||||
const { requests } = installTauriHostBridgeRecorder();
|
||||
window.history.replaceState(
|
||||
null,
|
||||
'',
|
||||
nativeAppPath(['navigation.openNativePage']),
|
||||
);
|
||||
|
||||
render(<TestWrapper withAuth />);
|
||||
|
||||
await user.click(screen.getByRole('button', { name: '发现' }));
|
||||
await user.click(await screen.findByRole('tab', { name: '寓教于乐' }));
|
||||
await user.click(await screen.findByRole('button', { name: /热身关卡/u }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
requests.some(
|
||||
(request) =>
|
||||
request.method === 'navigation.openNativePage' &&
|
||||
(request.payload as { url?: string }).url === '/child-motion-demo',
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
expect(window.location.pathname).toBe('/');
|
||||
});
|
||||
|
||||
test('embedded puzzle form maps raw bearer token errors to user-facing auth copy', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user