// // WeChatShareModels.swift // suixinkan // import Foundation /// 微信分享目标场景。 enum WeChatShareScene: Int, CaseIterable, Sendable { /// 微信好友会话。 case session = 0 /// 朋友圈。 case timeline = 1 /// 微信收藏。 case favorite = 2 /// 展示用标题。 var title: String { switch self { case .session: "微信好友" case .timeline: "朋友圈" case .favorite: "收藏" } } /// 映射到微信 SDK 的 scene 常量。 var wxSceneValue: Int32 { Int32(rawValue) } } /// 微信分享请求结果。 enum WeChatShareResult: Equatable, Sendable { case success case cancelled case notInstalled case unsupported case invalidPayload(String) case sendFailed(Int) case unknown(Int) /// 根据微信 SDK 错误码解析分享结果。 static func fromWXErrorCode(_ code: Int32) -> WeChatShareResult { switch code { case 0: .success case -2: .cancelled default: .unknown(Int(code)) } } } /// 网页分享载荷,供业务层与分享服务之间传递。 struct WeChatWebPageSharePayload: Equatable, Sendable { let title: String let description: String let url: String } /// 文本分享载荷。 struct WeChatTextSharePayload: Equatable, Sendable { let text: String } /// 图片分享载荷。 struct WeChatImageSharePayload: Equatable, Sendable { let imageData: Data }