
- 在Info.plist中新增API签名密钥配置。 - 将Splash视图替换为SplashV2,优化启动逻辑和用户体验。 - 更新API请求中的User-Agent逻辑,使用UserAgentProvider提供的动态值。 - 在APILogger中添加敏感信息脱敏处理,增强安全性。 - 新增CreateFeedPage视图,支持用户发布动态功能。 - 更新MainPage和Splash视图的导航逻辑,整合统一的AppRoute管理。 - 移除冗余的SplashFeature视图,提升代码整洁性和可维护性。
78 lines
1.9 KiB
Swift
78 lines
1.9 KiB
Swift
enum AppEnvironment {
|
||
case development
|
||
case production
|
||
}
|
||
|
||
struct AppConfig {
|
||
static let current: AppEnvironment = {
|
||
#if DEBUG
|
||
return .development
|
||
#else
|
||
return .production
|
||
#endif
|
||
}()
|
||
|
||
static var baseURL: String {
|
||
switch current {
|
||
case .development:
|
||
return "http://beta.api.molistar.xyz";//"http://beta.api.pekolive.com"
|
||
case .production:
|
||
return "https://api.epartylive.com"
|
||
}
|
||
}
|
||
|
||
/// Web页面路径前缀
|
||
/// - development环境: "/molistar"
|
||
/// - production环境: "/eparty"
|
||
static var webPathPrefix: String {
|
||
switch current {
|
||
case .development:
|
||
return "/molistar"
|
||
case .production:
|
||
return "/eparty"
|
||
}
|
||
}
|
||
|
||
// 添加更多环境变量
|
||
static var analyticsKey: String {
|
||
switch current {
|
||
case .development: return "dev_analytics_key"
|
||
case .production: return "prod_analytics_key"
|
||
}
|
||
}
|
||
|
||
// 运行时切换环境(用于测试)
|
||
// static func switchEnvironment(to env: Environment) {
|
||
// current = env
|
||
// }
|
||
|
||
// 网络调试配置
|
||
static var enableNetworkDebug: Bool {
|
||
switch current {
|
||
case .development:
|
||
return true
|
||
case .production:
|
||
return false
|
||
}
|
||
}
|
||
|
||
// 服务器信任配置
|
||
static var serverTrustPolicies: [String: ServerTrustEvaluating] {
|
||
switch current {
|
||
case .development:
|
||
return ["beta.api.molistar.xyz": DisabledTrustEvaluator()]
|
||
case .production:
|
||
return ["api.epartylive.com": PublicKeysTrustEvaluator()]
|
||
}
|
||
}
|
||
|
||
static var networkDebugEnabled: Bool {
|
||
switch current {
|
||
case .development:
|
||
return true
|
||
case .production:
|
||
return false
|
||
}
|
||
}
|
||
}
|