清理排查过程的非必需改动:移除 onActive 保活与 H5 console 调试转发
定位 touch→mouse 时序为真因后,清理排查途中加入但最终非必需的代码:
- 移除 onActive/notifyShown(基于"ArkWeb 未激活态暂停动画"的误判;实测页面本就 active/visible,无需)。
含 WebSlot.notifyShown + setup 调用 + BridgeGameContainer NavDestination.onShown。
- 移除 onConsole H5 console→hilog 调试转发(三容器 + webConsoleOn 字段 + logWebConsole + 多余 AppEnv 引入)。
保留:touch→mouse shim(真正修复)、expandSafeArea(白边修复)、debug 版 setWebDebuggingAccess。
(合成保活、SYNC_RENDER 已于 0caf385 移除。)devecocli build 通过、真机正常启动。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0caf3853af
commit
4b291396bc
@@ -39,8 +39,6 @@ export struct BridgeGameContainer {
|
||||
@State private sharePanelVisible: boolean = false;
|
||||
/** 当前分享面板的一次性回投事件名(用户选定平台后 emit 回 ShareProvider)。 */
|
||||
private shareResultEvent: string = '';
|
||||
/** H5 console 转发开关(构造期固化为编译期 DEBUG 常量;release 下 onConsole 仅一次字段读取即返回,零日志开销)。 */
|
||||
private readonly webConsoleOn: boolean = AppEnv.isDebug();
|
||||
|
||||
aboutToAppear(): void {
|
||||
if (AppEnv.isDebug()) {
|
||||
@@ -205,15 +203,6 @@ export struct BridgeGameContainer {
|
||||
return this.params.entryUrl !== '' ? this.params.entryUrl : $rawfile('test_echo.html');
|
||||
}
|
||||
|
||||
/** 转发 H5 console 到 hilog(debug 限定,带角色/级别/来源行,便于排查 H5 报错)。tag=WebConsole。 */
|
||||
private logWebConsole(role: string, event: OnConsoleEvent): void {
|
||||
if (!this.webConsoleOn) {
|
||||
return;
|
||||
}
|
||||
const m: ConsoleMessage = event.message;
|
||||
Logger.tag('WebConsole').i(`[${role}][lv${m.getMessageLevel()}] ${m.getMessage()} @${m.getSourceId()}:${m.getLineNumber()}`);
|
||||
}
|
||||
|
||||
build() {
|
||||
NavDestination() {
|
||||
Stack() {
|
||||
@@ -235,10 +224,6 @@ export struct BridgeGameContainer {
|
||||
this.slotL?.onFirstProgress();
|
||||
}
|
||||
})
|
||||
.onConsole((event: OnConsoleEvent) => {
|
||||
this.logWebConsole('lobby', event);
|
||||
return false;
|
||||
})
|
||||
.onRenderExited((event: OnRenderExitedEvent) => this.slotL?.onRenderExited(event.renderExitReason))
|
||||
|
||||
// 子游戏 Web(临时,subgameUrl 非空时存在)
|
||||
@@ -258,10 +243,6 @@ export struct BridgeGameContainer {
|
||||
this.slotS?.onFirstProgress();
|
||||
}
|
||||
})
|
||||
.onConsole((event: OnConsoleEvent) => {
|
||||
this.logWebConsole('subgame', event);
|
||||
return false;
|
||||
})
|
||||
.onRenderExited((event: OnRenderExitedEvent) => this.slotS?.onRenderExited(event.renderExitReason))
|
||||
}
|
||||
|
||||
@@ -273,8 +254,6 @@ export struct BridgeGameContainer {
|
||||
.width('100%').height('100%')
|
||||
}
|
||||
.hideTitleBar(true)
|
||||
// 页面(重新)可见时激活当前槽的 Web 引擎,恢复 CSS 动画/rAF(首次进大厅 + 从通用网页返回)
|
||||
.onShown(() => this.activeSlot()?.notifyShown())
|
||||
.onBackPressed(() => {
|
||||
// 分享面板打开时,返回键关闭面板并按取消回投(对齐 Android 点空白关闭)
|
||||
if (this.sharePanelVisible) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { common, Want } from '@kit.AbilityKit';
|
||||
import { window } from '@kit.ArkUI';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { SettingsProxy } from 'feature_bridge';
|
||||
import { AppEnv, Logger } from 'common';
|
||||
import { Logger } from 'common';
|
||||
import { GenericWebParams, GenericWebResult } from '../routes/AppRoutes';
|
||||
|
||||
/**
|
||||
@@ -24,8 +24,6 @@ export struct GenericWebContainer {
|
||||
private loaded: boolean = false;
|
||||
private exitDialog: boolean = false;
|
||||
private backToH5: boolean = false;
|
||||
/** H5 console 转发开关(构造期固化 DEBUG;release 下 onConsole 仅字段读取即返回)。 */
|
||||
private readonly webConsoleOn: boolean = AppEnv.isDebug();
|
||||
|
||||
aboutToAppear(): void {
|
||||
// settings 6 方法委托容器能力(§11.3)
|
||||
@@ -94,14 +92,6 @@ export struct GenericWebContainer {
|
||||
this.controller.runJavaScript(`getWebdata(${this.jsArg(this.params.data)})`);
|
||||
}
|
||||
})
|
||||
.onConsole((event: OnConsoleEvent) => {
|
||||
// 转发 H5 console 到 hilog(debug 限定,tag=WebConsole);release 仅字段读取即返回
|
||||
if (this.webConsoleOn) {
|
||||
const m: ConsoleMessage = event.message;
|
||||
Logger.tag('WebConsole').i(`[genericweb][lv${m.getMessageLevel()}] ${m.getMessage()} @${m.getSourceId()}:${m.getLineNumber()}`);
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
.hideTitleBar(true)
|
||||
.onBackPressed(() => {
|
||||
|
||||
@@ -74,23 +74,6 @@ export class WebSlot {
|
||||
} catch (e) {
|
||||
WebSlot.log.e(`[${this.role}] capability registration failed (bridge usable): ${(e as Error).message}`);
|
||||
}
|
||||
// 激活槽(大厅/子游戏)首次建好即通知 Web 引擎进入激活态——否则 ArkWeb 默认未激活态会
|
||||
// 暂停 CSS 动画/requestAnimationFrame(官方:onInactive 暂停动画),表现为"画面在但缩放等动画不播放"。
|
||||
if (this.active) {
|
||||
this.notifyShown();
|
||||
}
|
||||
}
|
||||
|
||||
/** 页面可见时确保 Web 引擎处于激活态,恢复 CSS 动画/rAF(与 NavDestination onShown 配合,幂等)。 */
|
||||
notifyShown(): void {
|
||||
if (this.disposed) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.controller.onActive();
|
||||
} catch (e) {
|
||||
WebSlot.log.w(`[${this.role}] onActive(notifyShown) failed: ${(e as BusinessError).message}`);
|
||||
}
|
||||
}
|
||||
|
||||
onLoadIntercept(url: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user