fix(mobile-app): 遍历路由栈检测当前页面,修复push导航检测问题

之前只检查 currentConfiguration.uri.path,对于 push 导航的页面无法正确检测。
现在遍历整个 matches 路由栈,只要栈中有合同/KYC页面就跳过弹窗。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-26 00:14:24 -08:00
parent 73f2b85ddf
commit aae4f1e360
1 changed files with 11 additions and 7 deletions

View File

@ -110,15 +110,19 @@ class _HomeShellPageState extends ConsumerState<HomeShellPage>
}
// 2. /KYC页面
// 使 appRouterProvider
// /KYC相关页面
try {
final router = ref.read(appRouterProvider);
final location = router.routerDelegate.currentConfiguration.uri.path;
debugPrint('[HomeShellPage] 当前路由(provider): $location');
//
if (location.startsWith('/contract-signing')) return true;
// KYC
if (location.startsWith('/kyc')) return true;
final matches = router.routerDelegate.currentConfiguration.matches;
for (final match in matches) {
final location = match.matchedLocation;
debugPrint('[HomeShellPage] 路由栈: $location');
//
if (location.startsWith('/contract-signing')) return true;
// KYC
if (location.startsWith('/kyc')) return true;
}
return false;
} catch (e) {
debugPrint('[HomeShellPage] 获取路由状态失败: $e');