feat: 更新 WebView 数据目录,添加持久存储清理逻辑;优化 URL 生成和 H5 路由刷新时的品牌保持

This commit is contained in:
Booker
2026-05-26 19:31:28 +07:00
parent 48e4229cb7
commit 7702dee27f
4 changed files with 165 additions and 24 deletions

View File

@@ -28,4 +28,23 @@ void main() {
expect(uri.toString(), isNot(contains('%25')));
expect(Uri.splitQueryString(uri.fragment)['shell_app_logo'], logo);
});
test('keeps shell branding when refreshing an H5 route URL', () {
const logo = 'data:image/png;base64,routeLogo+/=';
final uri = Uri.parse(
AppConfig.withFreshShellParams(
'https://h5-im.imharry.work/login?from=runtime',
appName: 'Shell Route',
appLogo: logo,
),
);
expect(uri.path, '/login');
expect(uri.queryParameters['from'], 'runtime');
expect(uri.queryParameters['flutter_shell'], '1');
expect(uri.queryParameters['shell_app_name'], 'Shell Route');
expect(uri.queryParameters['shell_cache_bust'], isNotEmpty);
expect(Uri.splitQueryString(uri.fragment)['shell_app_logo'], logo);
});
}