- 实现环境配置管理,支持外部和本地主机模式切换 - 集成Demo API接口,包含登录、注册、文件上传等功能 - 构建附件处理仓库,支持图片、视频、音频和文件发送 - 开发认证仓库,管理用户会话和IM令牌刷新机制 - 添加语音录制功能,支持实时音频消息录制 - 创建依赖注入容器,统一管理应用组件实例 - 实现登录界面,提供用户认证交互功能 - 开发聊天界面,集成消息收发和媒体处理功能
45 行
1.1 KiB
Swift
45 行
1.1 KiB
Swift
import Foundation
|
|
|
|
public struct SDKConfig: Sendable {
|
|
public let appId: String
|
|
public let appKey: String
|
|
public let appSecret: String
|
|
public let apiBaseURL: URL
|
|
public let imWebSocketURL: URL
|
|
public let debug: Bool
|
|
|
|
public init(
|
|
appId: String,
|
|
appKey: String,
|
|
appSecret: String,
|
|
apiBaseURL: URL,
|
|
imWebSocketURL: URL,
|
|
debug: Bool = false
|
|
) {
|
|
self.appId = appId
|
|
self.appKey = appKey
|
|
self.appSecret = appSecret
|
|
self.apiBaseURL = apiBaseURL
|
|
self.imWebSocketURL = imWebSocketURL
|
|
self.debug = debug
|
|
}
|
|
}
|
|
|
|
public extension SDKConfig {
|
|
static func development(
|
|
appId: String,
|
|
appSecret: String,
|
|
appKey: String? = nil,
|
|
debug: Bool = false
|
|
) -> SDKConfig {
|
|
SDKConfig(
|
|
appId: appId,
|
|
appKey: appKey ?? appId,
|
|
appSecret: appSecret,
|
|
apiBaseURL: URL(string: "http://192.168.116.9:8081")!,
|
|
imWebSocketURL: URL(string: "ws://192.168.116.9:8082/ws/im")!,
|
|
debug: debug
|
|
)
|
|
}
|
|
}
|