feat: 优化 URL 生成逻辑并添加同步品牌信息功能

This commit is contained in:
Booker
2026-05-25 11:48:56 +07:00
parent b836560e0e
commit 4e45ead752
2 changed files with 21 additions and 20 deletions

View File

@@ -17,14 +17,13 @@ class AppConfig {
return _environmentHosts[currentEnvironment] ?? const [];
}
static String homeUrl({String? appName, String? appLogo}) {
static String homeUrl({String? appName}) {
final host = environmentHosts.isNotEmpty
? environmentHosts.first
: 'h5-im.imharry.work';
return _withShellBranding(
_normalizeHomeUrl(host),
appName: appName,
appLogo: appLogo,
);
}
@@ -39,7 +38,6 @@ class AppConfig {
static String _withShellBranding(
String url, {
String? appName,
String? appLogo,
}) {
final uri = Uri.parse(url);
final queryParameters = Map<String, String>.from(uri.queryParameters)
@@ -50,21 +48,6 @@ class AppConfig {
queryParameters['shell_app_name'] = trimmedName;
}
final fragmentParameters = Map<String, String>.from(
Uri.splitQueryString(uri.fragment),
);
final trimmedLogo = (appLogo ?? AppConfig.appLogo).trim();
if (trimmedLogo.isNotEmpty) {
fragmentParameters['shell_app_logo'] = trimmedLogo;
}
return uri
.replace(
queryParameters: queryParameters,
fragment: fragmentParameters.isEmpty
? null
: Uri(queryParameters: fragmentParameters).query,
)
.toString();
return uri.replace(queryParameters: queryParameters).toString();
}
}