feat: 更新API相关逻辑及视图结构

- 在Info.plist中新增API签名密钥配置。
- 将Splash视图替换为SplashV2,优化启动逻辑和用户体验。
- 更新API请求中的User-Agent逻辑,使用UserAgentProvider提供的动态值。
- 在APILogger中添加敏感信息脱敏处理,增强安全性。
- 新增CreateFeedPage视图,支持用户发布动态功能。
- 更新MainPage和Splash视图的导航逻辑,整合统一的AppRoute管理。
- 移除冗余的SplashFeature视图,提升代码整洁性和可维护性。
This commit is contained in:
edwinQQQ
2025-09-17 16:37:21 +08:00
parent c57bde4525
commit 8b4eb9cb7e
23 changed files with 640 additions and 646 deletions

View File

@@ -0,0 +1,54 @@
import Foundation
import UIKit
@MainActor
struct DeviceContext: Sendable {
let languageCode: String
let osName: String
let osVersion: String
let deviceModel: String
let deviceId: String
let appName: String
let appVersion: String
let channel: String
let screenScale: String
static let shared: DeviceContext = {
// 线 UIKit/Bundle
let language = Locale.current.language.languageCode?.identifier ?? "en"
let osName = "iOS"
let osVersion = UIDevice.current.systemVersion
let deviceModel = UIDevice.current.model
let deviceId = UIDevice.current.identifierForVendor?.uuidString ?? UUID().uuidString
let appName = Bundle.main.infoDictionary?["CFBundleName"] as? String ?? "eparty"
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0"
#if DEBUG
let channel = "molistar_enterprise"
#else
let channel = "appstore"
#endif
let scale = String(format: "%.2f", Double(UIScreen.main.scale))
return DeviceContext(
languageCode: language,
osName: osName,
osVersion: osVersion,
deviceModel: deviceModel,
deviceId: deviceId,
appName: appName,
appVersion: appVersion,
channel: channel,
screenScale: scale
)
}()
}
enum UserAgentProvider {
@MainActor
static func userAgent() -> String {
let ctx = DeviceContext.shared
return "\(ctx.appName)/\(ctx.appVersion) (\(ctx.deviceModel); \(ctx.osName) \(ctx.osVersion); Scale/\(ctx.screenScale))"
}
}