Files
real-e-party-iOS/YuMi/E-P/Common/EPConfigAPI.swift
edwinQQQ 681b011c99 refactor: 更新 AppDelegate 和模块导入以简化配置管理
主要变更:
1. 移除不必要的模块导入,简化 AppDelegate 中的代码结构。
2. 引入新的 EPConfigManager 和 EPNIMManager,统一配置管理和 NIMSDK 初始化逻辑。
3. 更新相关方法以使用 block 回调,提升代码的可读性和维护性。
4. 新增 EPClientAPIBridge 和相关配置文件,增强项目的模块化。

此更新旨在提升代码的可维护性,减少冗余实现,确保配置管理的一致性。
2025-10-20 18:07:44 +08:00

38 lines
1.1 KiB
Swift

//
// EPConfigAPI.swift
// YuMi
//
// Thin Swift wrapper aligning EP module naming, for client/init & client/config
//
import Foundation
@objc final class EPConfigAPI: NSObject {
/// GET client/init returns payload dictionary when code == 200
@objc static func clientInit(
completion: @escaping (_ data: [String: Any]?, _ code: Int, _ msg: String?) -> Void
) {
Api.clientInitConfig { baseModel, code, msg in
var dict: [String: Any]? = nil
if code == 200, let payload = baseModel?.data as? [String: Any] {
dict = payload
}
completion(dict, Int(code), msg)
}
}
/// GET client/config treat success as code 200 (no payload)
@objc static func clientConfig(
completion: @escaping (_ data: [String: Any]?, _ code: Int, _ msg: String?) -> Void
) {
// ClientConfig has + (instancetype)shareConfig; bridged to Swift as .share()
// If the symbol differs, adjust to your Swift name (e.g., shareConfig()).
ClientConfig.share().clientConfig {
completion(nil, 200, nil)
}
}
}