Compare commits
No commits in common. "8799a6254420ba224de025d6a282175e25b3b229" and "55d035cb9cf1cf59535c6974fd0cbcb38f3ca75a" have entirely different histories.
8799a62544
...
55d035cb9c
|
|
@ -199,12 +199,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
return generation == _webViewGeneration;
|
return generation == _webViewGeneration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _debugLog(String message) {
|
|
||||||
if (kDebugMode) {
|
|
||||||
debugPrint(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlatformWebViewWidgetCreationParams _buildAndroidWidgetParams(
|
PlatformWebViewWidgetCreationParams _buildAndroidWidgetParams(
|
||||||
PlatformWebViewWidgetCreationParams widgetParams,
|
PlatformWebViewWidgetCreationParams widgetParams,
|
||||||
AndroidRenderMode renderMode,
|
AndroidRenderMode renderMode,
|
||||||
|
|
@ -288,11 +282,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
_hasMeasuredProgress = true;
|
_hasMeasuredProgress = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_debugLog(
|
|
||||||
'🔍 [onProgress] progress=$progress, '
|
|
||||||
'hasStartedRemote=$_hasStartedRemoteMainFrame, '
|
|
||||||
'hasMeasured=$_hasMeasuredProgress',
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
onNavigationRequest: (request) async {
|
onNavigationRequest: (request) async {
|
||||||
if (!_isActiveWebViewGeneration(generation)) {
|
if (!_isActiveWebViewGeneration(generation)) {
|
||||||
|
|
@ -327,13 +316,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
_hasStartedRemoteMainFrame = true;
|
_hasStartedRemoteMainFrame = true;
|
||||||
_cancelStartupWatchdog();
|
_cancelStartupWatchdog();
|
||||||
_recordWebViewEvent('页面开始加载:$url');
|
_recordWebViewEvent('页面开始加载:$url');
|
||||||
_debugLog(
|
|
||||||
'🔍 [onPageStarted] url=$url, '
|
|
||||||
'hasStartedRemote=$_hasStartedRemoteMainFrame, '
|
|
||||||
'hasBootstrapped=$_hasBootstrapped, '
|
|
||||||
'hasMainFrameError=$_hasMainFrameError, '
|
|
||||||
'watchdog已取消',
|
|
||||||
);
|
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -359,12 +341,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
}
|
}
|
||||||
_recordWebViewEvent('页面加载完成:$url');
|
_recordWebViewEvent('页面加载完成:$url');
|
||||||
_cancelStartupWatchdog();
|
_cancelStartupWatchdog();
|
||||||
_debugLog(
|
|
||||||
'🔍 [onPageFinished] url=$url, '
|
|
||||||
'hasMainFrameError=$_hasMainFrameError, '
|
|
||||||
'injectBridge=${!_hasMainFrameError}, '
|
|
||||||
'retryCount=$_startupRetryCount',
|
|
||||||
);
|
|
||||||
if (!_hasMainFrameError) {
|
if (!_hasMainFrameError) {
|
||||||
unawaited(_injectAppShellBridge(_controller, url));
|
unawaited(_injectAppShellBridge(_controller, url));
|
||||||
}
|
}
|
||||||
|
|
@ -416,11 +392,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
'url=${error.url}, '
|
'url=${error.url}, '
|
||||||
'description=${error.description}',
|
'description=${error.description}',
|
||||||
);
|
);
|
||||||
_debugLog(
|
|
||||||
'🔍 [onWebResourceError] isMainFrame=${error.isForMainFrame}, '
|
|
||||||
'errorType=${error.errorType}, '
|
|
||||||
'willSetMainFrameError=${error.isForMainFrame != false}',
|
|
||||||
);
|
|
||||||
if (!mounted || error.isForMainFrame == false) {
|
if (!mounted || error.isForMainFrame == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -505,19 +476,10 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleStartupTimeout() async {
|
Future<void> _handleStartupTimeout() async {
|
||||||
_debugLog(
|
|
||||||
'🔍 [_handleStartupTimeout] mounted=$mounted, '
|
|
||||||
'isLoading=$_isLoadingPage, '
|
|
||||||
'hasMainFrameError=$_hasMainFrameError, '
|
|
||||||
'hasStartedRemote=$_hasStartedRemoteMainFrame, '
|
|
||||||
'retryCount=$_startupRetryCount, '
|
|
||||||
'renderIndex=$_renderModeIndex',
|
|
||||||
);
|
|
||||||
if (!mounted ||
|
if (!mounted ||
|
||||||
!_isLoadingPage ||
|
!_isLoadingPage ||
|
||||||
_hasMainFrameError ||
|
_hasMainFrameError ||
|
||||||
_hasStartedRemoteMainFrame) {
|
_hasStartedRemoteMainFrame) {
|
||||||
_debugLog('🔍 [_handleStartupTimeout] 提前返回,不执行超时恢复');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -525,11 +487,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
final maxRetryCount = _androidCompatibilityPlan.prefersAggressiveRecovery
|
final maxRetryCount = _androidCompatibilityPlan.prefersAggressiveRecovery
|
||||||
? 2
|
? 2
|
||||||
: 1;
|
: 1;
|
||||||
_debugLog(
|
|
||||||
'🔍 [_handleStartupTimeout] switchedRenderMode=$switchedRenderMode, '
|
|
||||||
'maxRetryCount=$maxRetryCount, '
|
|
||||||
'currentRetryCount=$_startupRetryCount',
|
|
||||||
);
|
|
||||||
|
|
||||||
if (switchedRenderMode || _startupRetryCount < maxRetryCount) {
|
if (switchedRenderMode || _startupRetryCount < maxRetryCount) {
|
||||||
final nextRetryCount = _startupRetryCount + 1;
|
final nextRetryCount = _startupRetryCount + 1;
|
||||||
|
|
@ -548,7 +505,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_debugLog('🔍 [_handleStartupTimeout] 所有重试已耗尽,显示错误页面');
|
|
||||||
_setMainFrameError(
|
_setMainFrameError(
|
||||||
title: '页面启动超时',
|
title: '页面启动超时',
|
||||||
message: <String>[
|
message: <String>[
|
||||||
|
|
@ -560,10 +516,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setMainFrameError({required String title, required String message}) {
|
void _setMainFrameError({required String title, required String message}) {
|
||||||
_debugLog(
|
|
||||||
'🔍 [_setMainFrameError] title=$title, '
|
|
||||||
'message=$message',
|
|
||||||
);
|
|
||||||
_cancelStartupWatchdog();
|
_cancelStartupWatchdog();
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -576,12 +528,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
_errorMessage = message;
|
_errorMessage = message;
|
||||||
_progress = 0;
|
_progress = 0;
|
||||||
});
|
});
|
||||||
_debugLog(
|
|
||||||
'🔍 [_setMainFrameError] 状态已更新: '
|
|
||||||
'isLoading=$_isLoadingPage, '
|
|
||||||
'hasMainFrameError=$_hasMainFrameError, '
|
|
||||||
'→ 应显示 ErrorOverlay',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _recoverFromBrokenStartupState({bool deepReset = false}) async {
|
Future<void> _recoverFromBrokenStartupState({bool deepReset = false}) async {
|
||||||
|
|
@ -1077,15 +1023,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
final showProgressBar =
|
final showProgressBar =
|
||||||
_isLoadingPage && (!_hasMeasuredProgress || _progress < 100);
|
_isLoadingPage && (!_hasMeasuredProgress || _progress < 100);
|
||||||
final showLaunchOverlay = !_hasBootstrapped && !_hasMainFrameError;
|
final showLaunchOverlay = !_hasBootstrapped && !_hasMainFrameError;
|
||||||
_debugLog(
|
|
||||||
'🔍 [build] showProgressBar=$showProgressBar, '
|
|
||||||
'showLaunchOverlay=$showLaunchOverlay, '
|
|
||||||
'showErrorOverlay=$_hasMainFrameError, '
|
|
||||||
'showWebView=${!_hasMainFrameError}, '
|
|
||||||
'isLoading=$_isLoadingPage, '
|
|
||||||
'hasBootstrapped=$_hasBootstrapped, '
|
|
||||||
'progress=$_progress',
|
|
||||||
);
|
|
||||||
|
|
||||||
return PopScope<void>(
|
return PopScope<void>(
|
||||||
canPop: false,
|
canPop: false,
|
||||||
|
|
@ -1104,7 +1041,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: SizedBox.expand(
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Visibility(
|
Visibility(
|
||||||
|
|
@ -1141,7 +1077,6 @@ class _WebShellPageState extends State<WebShellPage>
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue