
主要变更: 1. 新增 EPImageUploader.swift 和 EPProgressHUD.swift,提供图片批量上传和进度显示功能。 2. 新建 EPMomentAPISwiftHelper.swift,封装动态 API 的 Swift 版本。 3. 更新 EPMomentPublishViewController,集成新上传功能并实现发布成功通知。 4. 创建多个文档,包括实施报告、检查清单和快速使用指南,详细记录功能实现和使用方法。 5. 更新 Bridging Header,确保 Swift 和 Objective-C 代码的互操作性。 此功能旨在提升用户体验,简化动态发布流程,并提供清晰的文档支持。
57 lines
1.7 KiB
Swift
57 lines
1.7 KiB
Swift
//
|
||
// EPQCloudConfig.swift
|
||
// YuMi
|
||
//
|
||
// Created by AI on 2025-10-11.
|
||
//
|
||
|
||
import Foundation
|
||
|
||
/// QCloud 配置数据模型(对应 UploadFileModel)
|
||
struct EPQCloudConfig {
|
||
let secretId: String
|
||
let secretKey: String
|
||
let sessionToken: String
|
||
let bucket: String
|
||
let region: String
|
||
let customDomain: String
|
||
let startTime: Int64
|
||
let expireTime: Int64
|
||
let appId: String
|
||
let accelerate: Int
|
||
|
||
/// 从 API 返回的 dictionary 初始化
|
||
/// API: GET tencent/cos/getToken
|
||
init?(dictionary: [String: Any]) {
|
||
// 必填字段检查
|
||
guard let secretId = dictionary["secretId"] as? String,
|
||
let secretKey = dictionary["secretKey"] as? String,
|
||
let sessionToken = dictionary["sessionToken"] as? String,
|
||
let bucket = dictionary["bucket"] as? String,
|
||
let region = dictionary["region"] as? String,
|
||
let customDomain = dictionary["customDomain"] as? String,
|
||
let appId = dictionary["appId"] as? String else {
|
||
return nil
|
||
}
|
||
|
||
self.secretId = secretId
|
||
self.secretKey = secretKey
|
||
self.sessionToken = sessionToken
|
||
self.bucket = bucket
|
||
self.region = region
|
||
self.customDomain = customDomain
|
||
self.appId = appId
|
||
|
||
// 可选字段使用默认值
|
||
self.startTime = (dictionary["startTime"] as? Int64) ?? 0
|
||
self.expireTime = (dictionary["expireTime"] as? Int64) ?? 0
|
||
self.accelerate = (dictionary["accelerate"] as? Int) ?? 0
|
||
}
|
||
|
||
/// 检查配置是否过期
|
||
var isExpired: Bool {
|
||
return Date().timeIntervalSince1970 > Double(expireTime)
|
||
}
|
||
}
|
||
|