
- 在DynamicsModels.swift中新增MyMomentInfo结构,专门用于处理/dynamic/getMyDynamic接口的响应数据。 - 更新MyMomentsResponse结构以使用MyMomentInfo,确保数据类型一致性。 - 在LoginModels.swift中重构IDLoginAPIRequest和EmailLoginRequest,优化queryParameters的实现方式,提升代码可读性。 - 在RecoverPasswordFeature中重构ResetPasswordRequest,优化queryParameters的实现方式,确保一致性。 - 在多个视图中添加调试信息,增强调试能力和用户体验。 - 更新Localizable.strings文件,新增动态列表为空时的提示信息,提升用户交互体验。
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"
|
||
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
|
||
}
|
||
}
|
||
}
|