修复订阅授权返回后生成中断

生成动作先进入拼图进度页并立即发起生成

订阅授权改为非阻塞尝试,避免闪回卡住提交

移除订阅结果回写 web-view URL 导致回首页的逻辑

更新小程序订阅消息授权与发送边界文档
This commit is contained in:
kdletters
2026-06-08 15:01:52 +08:00
parent 8f991a4ac2
commit 3ca5a460f1
9 changed files with 31 additions and 60 deletions
@@ -34,15 +34,35 @@ describe('wechatMiniProgramSubscribe', () => {
expect(requested).toBe(true);
expect(navigateTo).toHaveBeenCalledWith({
url: expect.stringMatching(
/^\/pages\/subscribe-message\/index\?.*autoRequest=1/u,
),
url: expect.stringMatching(/^\/pages\/subscribe-message\/index\?/u),
success: expect.any(Function),
fail: expect.any(Function),
});
expect(navigateTo.mock.calls[0]?.[0].url).not.toContain('autoRequest=1');
expect(window.location.hash).toBe('');
});
test('keeps waiting even when native page returns immediately after navigate success', async () => {
const navigateTo = vi.fn((options) => {
window.dispatchEvent(new Event('focus'));
options.success?.();
});
window.history.replaceState(
null,
'',
'/creation/puzzle?clientRuntime=wechat_mini_program',
);
window.wx = {
miniProgram: {
navigateTo,
},
};
const requested = await requestGenerationResultSubscribePermission();
expect(requested).toBe(true);
});
test('still accepts legacy hash result from native mini program page', async () => {
const navigateTo = vi.fn((options) => {
options.success?.();