feat: 添加登录页面 URL 检测功能;更新 H5ShellPage 状态管理以支持路由变化

This commit is contained in:
Booker
2026-05-27 13:16:35 +07:00
parent 6e3920972b
commit 179a2332ae
3 changed files with 119 additions and 1 deletions

View File

@@ -83,6 +83,19 @@ class AppConfig {
return url;
}
static bool isLoginPageUrl(String? url) {
if (url == null || url.isEmpty) {
return false;
}
final uri = Uri.tryParse(url);
if (uri == null) {
return false;
}
return _isLoginPath(uri.path) || _isLoginPath(uri.fragment);
}
static int? lineIndexForUrl(String url) {
final uri = Uri.tryParse(url);
if (uri == null) {
@@ -123,6 +136,21 @@ class AppConfig {
return index;
}
static bool _isLoginPath(String path) {
final normalized = path.trim();
if (normalized.isEmpty) {
return false;
}
final pathOnly = normalized.split('?').first.split('#').first;
final segments = pathOnly.split('/').where((segment) => segment.isNotEmpty);
if (segments.isEmpty) {
return false;
}
return segments.last == 'login';
}
static bool _isSameLine(Uri lineUri, Uri uri) {
if (lineUri.host.toLowerCase() != uri.host.toLowerCase()) {
return false;